406 Not acceptable with Accept header any - spring

I am trying to do DELETE http request to an API ( I don't have access to the source code of it) but the API keeps responding with 406.
I tried to put "Accept" header any but the issue still the same, I see the headers are correct.
Any help is appreciated

Related

Why I get 403 for the site request Jmeter

I have a problem with Jmeter . When I open homepage of https://demo.nopcommerce.com/ I get 403 but for other endpoint of this site I do not get this error. Should I add cookies for such case? SOrry , I just new to it...
will be grateful for any help
I cannot reproduce your issue, perhaps you recorded some HTTP Header which shouldn't be there for not-authenticated user.
Try disabling the HTTP Header Manager which is under your request /-60 and if you will be able to get HTTP status code 200 add another HTTP Header Manager and copy the headers there one by one until you will find the one which is causing the problem.

API call returns a response in postman but gives me 403 in browser

ajax call
postman url
console error
Postman returns a response, but browser gives me 403. I have attached my postman request, my ajax call as well as the browser error. Any advice is helpful
You need to pass credentials. follow this link for more information.
I ran into this issue as well. While cedric is right, the Authorization header needs to be specified, another issue can cause this as well. Postman does not include an Origin header in its requests (see: https://stackoverflow.com/a/68380707/1029688). This could cause it to ignore CORS errors that you would normally encounter when making web requests from a browser.

JMeter POST request is returning 200 OK instead of 302 (redirect)

I'm attempting to login to a website that uses IdentityServer with JMeter but am getting stuck at the point where I post my credentials.
If I inspect the request via fiddler, I can see that it returns a 302 with a redirect, however when I attempt to post the same request in JMeter, I get a 200 with 'Error' in the html with no details.
This is my request in JMeter....
This is the request in Fiddler....
And this is the HTML response in JMeter (200 OK)...
And this is the Fiddler response...
And this is the HTML response in Fiddler, after the redirect...
I can confirm that my JMeter variables ${COOKIE_idsrv.xsrf} and ${SignIn are populated with the correct values.
Other points to note
I have a HTTP Cookie Manager
The HTTP Manager Referer headers are set correctly
All requests are set to Follow Redirects
I retrieve all embedded resources for each request
Does anybody know what could be the issue here?
In your POST request, why do you have "signin" parameter included?. You have already added "signin" as a query parameter and it appears to be redundant and not required for the actual POST body data. Fiddler does not have it in both the places. Please check.
After much frustration it turned out the issue was due to ${COOKIE_idsrv.xsrf} not containing the correct value for idsrv.xsrf. Once I changed this to pull it from a previous request it seemed to work okay.

codeception get request with if-none-match does not return 304

i am using codeception for the code coverage of a REST API. In my current case, i want to test the behaviour of sending a request to receive an ETag-Header for the requested resource and reuse the value of this ETag in a second request on the same resource with the header "If-None-Match" to achieve a 304 response code.
So what I am doing in my Cest-File is:
// send first request, grab etag
$I->sendGET('/myresource');
$I->seeResponseCodeIs(200);
$I->seeHttpHeader('ETag');
$eTag = $I->grabHttpHeader('ETag');
// send second request with header "If-None-Match" containing the etag
$I->haveHttpHeader('If-None-Match', $eTag);
$I->sendGET('/myresource');
$I->seeHttpHeader('ETag');
$I->seeResponseCodeIs(304);
When I execute this test it fails after the second request saying that response code 200 does not match 304.
When I execute the same request with an external tool (HTTP Requester Plugin for Firefox), i get the expected behaviour. What do i have to do to get my tests working? Am i mssing something on the codeception side or may this be a bug?
Any help is appreciated, maybe someone already had this scenario before.
Thanks in advance for your help!

How can I get response header via cross-domain ajax?

I'm trying to read documentation and I must confess it is not an easy reading. I have no problem (after adding Access-Control-Allow-Origin header) to read responseText, but fail to get response header anywhere except Firefox.
So, my question is what is the right way to get response header, using cross-domain ajax?
I've tried to use (Access-Control-Expose-Headers), but, again, failed to read header.
So the way it should work is that you specify the headers you want the client to have access to in the Access-Control-Expose-Headers header. For example, if your server sets a Foo response header, and you want the client to be able to read it, your server should also send the following header:
Access-Control-Expose-Headers: Foo
On the client side, you can read all the response headers by calling xhr.getAllResponseHeaders(). This returns the response headers as a string, which you can then parse into an object using the following code: https://gist.github.com/706839
That is an explanation of how things should work. However, note that there is a bug in older browsers where the response headers can't be read on the client. See here for more details: CORS xmlhttprequest HEAD method
I had same problem, and found answer on Chromium mailing list that this is fixed in webkit, and it will be implemented in crhomium ~19.
I will try to find topic and update my answer.

Resources