POST 415 Unsupported Media Type in Postman; UI and JMeter works fine - api

So, I have wasted half a day with this and I am not getting anywhere.
I have a German application where I am sending a POST request and keep getting 415 Unsupported Media Type in Postman.
The same request works fine in UI and strangely in JMeter which is pretty much similar to Postman. I have tried all possible solutions listed in the internet including setting Content-Type (application/json, application/json,charset=utf-8) and Accept in the Headers yet the same results.
Here is my request Header in Postman
and the same request Headers in JMeter where it works (the only difference is I set the Encoding in a different place in JMeter and not in the Header and if I set it in the Header, I get a 400 instead of a 415)
Does setting the Content Encoding behave differently in JMeter? the Only place right now where I can set the encoding in Postman is through the Content-Type and that doesn't seem to work.

Related

API request by fetch/axios makes PDF content bigger

I have a Nest.js generated PDF that I am trying to download in React frontend.
Everything works fine when I use Postman or any other API client to request the PDF directly on the endpoint, but when I make a fetch/axios request in my frontend with the same method as stated here (conversion to blob/arraybuffer), the overall content is bigger (fonts, assets) and the texts are not selectable before. I sense that it has to be due to the responseType: blob, but I have not found any other solution whatsoever anywhere.
Does anybody have any idea how to overcome this issue?
The desired result (not working images is ok)
The fetch/axios result

Request body HTTP PUT sampler not sent

Recently I started using SmartMeter. Everything seems to work fine for other requests, but if I try to use the HTTP request sampler to test a PUT request the request body is not visible in the request:
<actual file content, not shown here>
Now I've searched the internet and it seems this was an recent issue with JMeter that should be fixed in v3.1, is this the same issue in SmartMeter and how should I be able to fix it?
Greetings!
I assume you are referring to this issue https://bz.apache.org/bugzilla/show_bug.cgi?id=60092. It has indeed been resolved in JMeter 3.1. Use SmartMeter 1.3.0 or newer.

how does alamofire know when there is a change in a JSON online?

im working on an app which fetches json from a website. everything is working properly and im using alamofire .
but for some reason, when i post new content on the website and the json file changes, alamofire doesnt get the new content. instead, it loads the content from the cache instead of redownloading the new content.
the only workaround to this is to clear the cache which is a way that i do not prefer since the user will have to download the content all over again at each view load.
so what im asking is, is there a way to notify the alamofire method about the new content and try to load the new content instead of having me to implement a method to clear the cache?
Alamofire uses the Foundation URL loading system, which relies on NSURLCache. The cache behavior for HTTP requests is determined by the contents of your HTTP response's Cache-Control headers. For example, you may wish to configure your server to specify must-revalidate:
Cache-Control: max-age=3600, must-revalidate
You should also make sure your server is specifying ETag and Content-Length headers to make it easy to tell when content has changed.
NSHipster's writeup on NSURLCache has a few good examples. If you're totally new to web caching, I recommend you read the very helpful section 13 of the HTTP 1.1 spec, and possibly also this caching tutorial.

How to use Etag with sailsjs

I'm trying to improve the cache capabilities on my sails application.
Sails generate a Etag with its response but when I try to do a GET request with a header 'if-None-Match' containing the Etag from the previous answer I can't get a 304 not Modified response from the server (the response is indeed not Modified and the Etag I receive is the same as the previous one).
I'm using POSTMAN to test the server responses.
Is there a way for a sails server to send such status code on unmodified responses ? I can't find any resource for Etag usage in sails doc.
Thank you.
Sails.js is based on Express.js and the ETags are generated by Express.js. And according to this answer, weak ETags are generated using CRC32 (source), strong ETags are generated using MD5 (source).
I use DHC - REST/HTTP API Client with If-None-Match header, it works perfect (return 304 Not Modified).
And I found that's because POSTMAN send NO-CACHE header to the server for testing purpose
'cache-control': 'no-cache',
You can follow this answer and turn off this feature then everything will be fine.

Can't get anything other than HTTP 202 response from eBay API

(Also posted this on the eBay Dev Forums, but it has low volume and is very slow)
I'm trying to build my first call to eBay's API. I am using Postman Chrome App, but have also tried the Python Requests library, with the same problem in each.
No matter what I send, I just get back an HTTP 202 code with an empty body, instead of the XML response I am expecting. This happens with either the sandbox or the production endpoint. Doesn't matter if I use correct or incorrect credentials, or a valid or invalid API call name.
Screenshot of building the call in Postman:
Finally heard back from eBay Support.
The problem is the trailing slash on the endpoint. Any kind of trailing slash will cause a generic 202 response. Removing it fixed the problem.