简体   繁体   中英

I am getting 400 Bad Request for ReST call only in internet explorer

In our running application, one of GET request starts giving response as 400 Bad Request in Internet Explorer.

On investigating , I found that GET request doesn't have queryParameters what were expected by ReST call.

As it is giving response in another browsers like Chrome, Mozilla, how can I proceed further ?

this is Request currently being triggered--

Method of request is GET

https://XXXXXXXXX/XXX/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX ?{%22numRecords%22:1000,%22start%22:0}&_=1487576597960

and queryParameters in @QueryParam expected by ReST api are-

-numRecords -start

I know by the above GET request, numRecords and start will not get captured by api backend.

So , is there any chance, if my GET request lack of any @QueryParam will lead to 400 Bad request response.

I found that GET request doesn't have queryParameters

You can use query parameters in GET requests as you've provided in your example like this: http://host?queryParam1=value1 . however it's not possible to pass a request body as you can do for POST or PUT requests to provide JSON encoded data for example. You can work around this by adding the JSON AND URL encoded payload to a query parameter. But you endpoint explicitely has to be able to read this parameter. So you should add this parameter to your definiotn like in this example for JAX-RS:

@GET
@Path("my-endpoint")
public String request(
        @PathParam("payload") JsonObject payload
) {

What you've tried is to simply pass the payload data without specifing the name of the request parameter.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM