Http 400 request error

I am seeing HTTP 400 error in gatling tests. THis is the request sample

          http("request_33")
            .get("/ietpata/exec/deadLinkFilter.aspx?VERSION=current&DOCNBR=A318_A319_A320_A321_TSM&MODEL=A319_A321_LAA_and_LUS_A321NX&DOCTYPE=TSM&ISESSION=1&CONTENTFRAME=HOR5YVZ0P7&REFKEY=INDEX")
            .headers(headers_20)

val headers_20 = Map(“REFERER” → “CORENA PINPOINT a Table of Contents”)

Not sure how to fix this problem. when i manually hit the URL its not responding with 400.
Do i need to make any changes?

400 means Bad Request.

Please understand that there’s no way for anyone to help you with so little information:

  • no Gatling version
  • no way to reproduce your issue
  • no idea of what the expected HTTP request look like
  • no idea of what the HTTP request generated by Gatling look like

Please help people help you. See How to Ask a Question

Pls find the detailed information
gatling - 3.8.4
Application - Dot Net Web application
Below request

object wiresearch {

val ws = exec(
  http("wsearch_0")
    .get("/ietpata/exec/searchDialog.aspx?MODEL=A319_A320_A321_LUS&VERSION=current&ISESSION=1&GROUP=all&CONTENTFRAME=OBVXO659FR&DOCNBR=A320_AWL&DOCTYPE=WM&LINKTYPE=external&FROMDOCNBR=A320_AWM&DOCNBRS=A320_AMM_NEW;A320_IPC_NEW;All_Fleet_Maintenance_Manual_AFMM_A320;A320_ASM;A320_AWL;A320_AWM;A319_A320_A321_LUS_CFM;Airbus_CML_A319_A320_A321_LUS;A319_A320_A321_ESPM;Airbus_SM_A319_A320_A321_LUS;LUS_A319_SRM;LUS_A320_SRM;LUS_A321_SRM;A320_TEM_A319_A320_A321_LUS;A320F_AARD_LUS;A320F_AAWRD_LUS;A320F_LUS_TroubleShooting_Booklet;A319_LUS_NACELLE_SRMSUP;A321_LUS_NACELLE_SRMSUP;LUS_A319_A320_GoGo_FIM_2KU;A319_A320_GoGo_2KU_SPM;A319_GoGo_2KU_AMM_Radome;A319_GoGo_2KU_IPC_Radome;A319_GoGo_2KU_WDM_Cabin;A319_GoGo_2KU__WDM_Radome;A319_GoGo_ATG4_IPC_LUS;A319_PED_EWIS;A320_GoGo_2KU_AMM_Radome;A320_GoGo_2KU_IPC_Cabin;A320_GoGo_ATG4_IPC;A320_Inflight_Canada_ISPS_AMM;A320___Inflight_Canada_ISPS_IPC;A320_Inflight_Canada_ISPS_SRM;A321_PRAM_AMM;A321_ViaSat_IPC;A321_ViaSat_IFE_ASMSUP;A320_Inflight_Canada_ISPS_FIM;A320F_Gogo_2KU_CRM;A320_LUS_Viasat_IFE_ADL&title=Search - AWM A319_A320_A321_LUS")
    .headers(headers_0)

val headers_0 = Map(
“Accept” → “text/html, application/xhtml+xml, image/jxr, /”,
“Accept-Encoding” → “gzip, deflate”,
“Accept-Language” → “en-US, en; q=0.5”,
“User-Agent” → “Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko”
)

Gatling gives HTTP400 error when i pass this request. But the same works correctly in postman.

This error return Server so you can check on server side what is wrong with this request.
Aditionally you can turn on full HTTP trafic to see what is send by Gatling.
Details information about that: Gatling - Debugging

Thanks. after enabling debugger i am able to see the request gives 400.
But the same request works fine in postman and gives 200 ok.
Attached

Are you sure to have at the end of request a " " space char in multiple places instead of encode this char as %20 ?
If this not help you must check this with devs responsible for this site.

Are you sure you don’t need a cookie?
Postman is known to use the cookie from the browser. But Gatling obviously can’t.

Yes it doesnt cookie. Any workarounds will be of help? I m getting stuck at this point.

But the same request works fine in postman and gives 200 ok.

Please print and provide the request postman generates. Otherwise, there’s no telling what the difference is.

I really suspect you’ve explicitly disabled url encoding? As @GeMi noticed, you really shouldn’t have white spaces in your URL but %20 instead.

I have created this case adding parts from this topic and created below scenario:

package pl.gemiusz;

import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import io.gatling.javaapi.http.HttpProtocolBuilder;

import static io.gatling.javaapi.core.CoreDsl.atOnceUsers;
import static io.gatling.javaapi.core.CoreDsl.scenario;
import static io.gatling.javaapi.http.HttpDsl.http;

public class CaseFooBarSimulation extends Simulation {

    HttpProtocolBuilder httpProtocol =
            http
                    .baseUrl("https://aaietpstage.aviationzone.net/");

       ScenarioBuilder scn =
            scenario("GeMi_FooBarSimulation")
                    .exec(
                            http("GeMi_FooBar_get_1")
                                    .get("/ietpata/exec/searchDialog.aspx?MODEL=A319_A320_A321_LUS&VERSION=current&ISESSION=1&GROUP=all&CONTENTFRAME=OBVXO659FR&DOCNBR=A320_AWL&DOCTYPE=WM&LINKTYPE=external&FROMDOCNBR=A320_AWM&DOCNBRS=A320_AMM_NEW;A320_IPC_NEW;All_Fleet_Maintenance_Manual_AFMM_A320;A320_ASM;A320_AWL;A320_AWM;A319_A320_A321_LUS_CFM;Airbus_CML_A319_A320_A321_LUS;A319_A320_A321_ESPM;Airbus_SM_A319_A320_A321_LUS;LUS_A319_SRM;LUS_A320_SRM;LUS_A321_SRM;A320_TEM_A319_A320_A321_LUS;A320F_AARD_LUS;A320F_AAWRD_LUS;A320F_LUS_TroubleShooting_Booklet;A319_LUS_NACELLE_SRMSUP;A321_LUS_NACELLE_SRMSUP;LUS_A319_A320_GoGo_FIM_2KU;A319_A320_GoGo_2KU_SPM;A319_GoGo_2KU_AMM_Radome;A319_GoGo_2KU_IPC_Radome;A319_GoGo_2KU_WDM_Cabin;A319_GoGo_2KU__WDM_Radome;A319_GoGo_ATG4_IPC_LUS;A319_PED_EWIS;A320_GoGo_2KU_AMM_Radome;A320_GoGo_2KU_IPC_Cabin;A320_GoGo_ATG4_IPC;A320_Inflight_Canada_ISPS_AMM;A320___Inflight_Canada_ISPS_IPC;A320_Inflight_Canada_ISPS_SRM;A321_PRAM_AMM;A321_ViaSat_IPC;A321_ViaSat_IFE_ASMSUP;A320_Inflight_Canada_ISPS_FIM;A320F_Gogo_2KU_CRM;A320_LUS_Viasat_IFE_ADL&title=Search - AWM A319_A320_A321_LUS")
                    );

    {
        setUp(scn.injectOpen(atOnceUsers(1)).protocols(httpProtocol));
    }
}

and after run Gatling doesn’t encode “automatically” spaces to %20 and getting HTTP 400 :confused: - I will today lately check this in a simpler example and if not work correctly raise a bug on github.

after change manually spaces to %20 it’s working → getting HTTP 302

So Gatling’s current behavior is that it expects a properly encoded url when being passed a static value.

We’ll change it in Gatling 3.9.1.

See HTTP: URL doesn't get encoded when it's a static url without queryParams · Issue #4366 · gatling/gatling · GitHub

2 Likes

Thanks @GeMi for investigating.

1 Like