Postman : Error: Parse Error: Invalid header value char - http

everyone. I'm trying to use postman for hitting our prod api, but I get some error:
I did not have that problem two days ago, and I have no idea what is happening. Anyone can advise ?

It looks like a new Postman build is using a stricter header parsing, which is causing some issues for response headers that are not well formatted.
https://github.com/postmanlabs/postman-app-support/issues/8747

Turning on the "Send no-cache Header" option resolved this for me:

It's probably related to response header. Try this request in your browser and if it works, look at the response headers in devtools/network to find an invalid character.
In my case request wasn't working in Postman for one specific id. When I looked into response in devtools, I found that there was a double quote inside a double-quoted string header value and I think it caused this error, but I may well be wrong here.
Anyway, try this exact GET request in browser and see if it works there.

I had this problem when I was setting headers in golang using http like this:
w.Header().Set("‫‪X-Frame-Options‬‬", "‫‪Deny‬‬")
It worked fine in curl but not in postman and I didn't understand what was wrong. I also checked my headers using -v option in curl. Everything was correct. So I substitute Postman with Insomnia and it's working with no problem.

When you give HttpStatusCode as NoContent, this issue comes up. If you change the HttpStatusCode, it will work.

Related

The response code or the response body, it gives me null

I am developing a mobile application in java. And I'm trying to get a json response from the free JSONplaceholder service. I have already tried a hundred ways such as OkHttp, HttpURLConnection and so on. And when I try to get the response code or the response body, it gives me null. Please, help. Perhaps this screenshot will help to understand what the problem is.
The problem was solved by setting the policy.
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

Set ':authority' header in Postman

I'm currently trying to replicate a https request with the following headers.
The authentication is based on a Session Cookie.
However, there is also a header field called :authority,
which I'm not able to replicate in Postman.
Also, couldn't I find any solution for that problem
or what exactly the :authority header means on the Internet.
This header seems to be required, as I'm getting a 400 error code back
as soon as I send my replicated request.
I've proxied the request sent from Postman and can confirm that the only difference at the first glance is the missing :authority header.
Thanks ^^
Alright, taking a closer look at the Raw Request, I noticed that the actual header is called Host and is mapped in the UI to :autority. Now its working. cheers

Fetching Comments of Comments with the LinkedIn API

The LinkedIn docs state how to collect comments of a comment here, but they seem to be incorrect. It says to make a GET request that looks like this:
https://api.linkedin.com/v2/socialActions/urn:li:comment:(activity:6273189577469632512,6275822846992351232)/comments
but when I try that all I get back is a 400 error with the message:
Syntax exception in path variables
Is this the correct formatting of the comment urn? I've tried encoding it like with other requests, but that returns back the same result. Seeing a working example of this request would really help.
After talking to LinkedIn API's support, I have the answer to why this wasn't working. A lot of the documentation contains these notes:
All API requests are represented in protocol 2.0.0 and require the
header X-Restli-Protocol-Version: 2.0.0.
I thought that those notes meant that all v2 requests are meant to have their headers contain X-Restli-Protocol-Version: 2.0.0, but in actuality, it is only the endpoints where that is specified in the pages of the documentation. In other words, using that header for endpoints where it isn't needed can cause some of the requests to fail in ways that aren't clear from the error message. Removing that from the header gave the correct response.

Sending data with CURL GET

I thought GET is not supposed to have a body. But in the context of elasticsearch, I keep seeing this kind of query (see here for instance):
curl -XGET localhost:9200/test/_msearch --data-binary #requests; echo
How is the binary data sent in this case? Can somebody explains what is going on and how this works?
I first thought it was converted to a POST but, I put a proxy in front of Elasticsearch and saw that curl was really sending a GET. Though I could find the data neither in the header, nor in the parameter, nor in the body. So it seems like my proxy also got confused by this request.
But when I execute the request directly against elasticsearch, it works just fine. What gives?
GETs with bodies are allowed but not considered to be very "meaningful". You can see this question and answer for a full discussion. HTTP GET with request body
and this answer about your proxy: https://stackoverflow.com/a/978173/3516034

Marketo - Invalid Content Type

I'm trying to use the insert lead api and I'm getting getting error 612 - "Invalid Content Type"
I know there are 2 different threads, as well as the explanation in the documentation that the request header needs to state "Content-Type: application/json"
I've tried both curl (as per the example in the documentation - which is wrong, btw) as well as java. Both clearly have "Content-Type" "application/json"
Any suggestions? Am I missing something? Any thoughts on how I might troubleshoot?
Any help would be really, really appreciated.
I do think it's related to Content-Type. Here is an example with Postman (chrome plug-in). I would check whether your call works as expected using Postman, then try to incorporate it into your code (Java or cURL).

Resources