By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When server is sending response which doesn't have HTTP/1.1 .... in the beginning of the message Postman Desktop app gives an error "Parse Error: The server returned a malformed response". Below error message from console.

"POST http://192.168.225.1/
Error: Parse Error: Expected HTTP/
Request Headers
Content-Type: application/json
User-Agent: PostmanRuntime/7.26.5
Accept: /
Host: 192.168.225.1
Request Body"

Response was otherwise only json. It is visible in Postman Chrome wihtout any errors.

Hey @SamuelH91

Are you able to provide us with an endpoint the full request that shows the issue as it's going to be difficult to reproduce the problem with that IP.

Which version of the app are you using?

  • Newest desktop application on Windows.
  • Normally server should start it's response with something like this

    HTTP/1.1 200 OK
    Date: < some date >
    Content-Type: application/json
    Content-Length: < actual size >

    {"example":"data"}

    This particular server skipped the beginning and went right to the json. Old Postman Chrome doesn't raise Parse Error like Postman Desktop version. Of course, I am able to see the response in Wireshark, but it isn't quite practical.

    Run it (listens on 80 port)
    python simpleTestServer.py
    Make any rest requests from Postman to localhost:
    -> Every other message from server to any request from postman gives parse error. (Starting from error)

    I'm also having a very similar exception on postman when a HEAD request returns any content-length != 0 (which RFC says HEAD should return content-length same to what it would've been in if it was a GET)

    I double checked with curl, same endpoint, same request, only difference is content-length being 0 and not.

    I'm getting the same error, simulating an empty request situation:

    Parse Error: The server returned a malformed response

    Error: Parse Error: Expected HTTP/

    Here are the full payloads captured using Wireshark:

    POST /wsRecarga.asmx/NotificarPagamentoProcessado HTTP/1.1
    Content-Type: application/json
    User-Agent: PostmanRuntime/7.26.10
    Accept: */*
    Cache-Control: no-cache
    Postman-Token: daa04e18-8e75-430e-b039-1b29deeec4a9
    Host: localhost:9080
    Accept-Encoding: gzip, deflate, br
    Connection: keep-alive
    Content-Length: 0
    HTTP/1.1 400 Bad Request
    Cache-Control: private, max-age=0
    Content-Length: 75
    Content-Type: application/json
    Server: Microsoft-IIS/10.0
    X-AspNet-Version: 4.0.30319
    X-SourceFiles: =?UTF-8?B?QzpcQ29kZVxiaXRidWNrZXRcdml2by13c3JlY2FyZ2Fcd3NSZWNhcmdhXHdzUmVjYXJnYS5hc214XE5vdGlmaWNhclBhZ2FtZW50b1Byb2Nlc3NhZG8=?=
    X-Powered-By: ASP.NET
    Date: Fri, 26 Feb 2021 18:55:56 GMT
    {"resultCode":"err","failureReason":"P0013","message":"Empty request body"}{"d":null}
    

    I think Postman should be able to parse the response or at least showing the raw response content, as it does for other situations.

    The same request via curl works as expected.

    i have the same error, but in my case it's because the server is configured as http/2, and i think (?) postman doesn't support that? at least from searching around it looks like that might be the case. Anyway might not help but thought i'd add here as it's the exact same response that I see when trying to query a get on http/2 service

    I've spend a hole day to figure out the issue but failed to resolved. It's not working for localhost, but for remote endpoint it works.

    below is the console output:

    In case this might be helpful for someone:
    I've been having this problem also on my local endpoint, i was sending HTTP status code 204 (No Content), i replaced it with 200 (OK) and everything worked fine
    I actually find this to be a strange issue, any explanations would be appreciated

    In my case, specify the status code fixed the problem. I had the same Parsing Error on Postman interface so I decided to do some tests using curl and I received the curl: (1) Received HTTP/0.9 when not allowed error. Then, forcing the proper status_code in the response header everything went smoothly.

    Seems we are affected by same issue.

    I am testing a local PHP/Apache website. it works fine for years we are developing, from command line and from API. Now tryting to use PostMan, and get the following in the PostMan console:

    GET http://tester2.local/api-v2/login
    Error: Parse Error: Expected HTTP/
    Request Headers
    User-Agent: PostmanRuntime/7.28.4
    Accept: */*
    Postman-Token: 1e8bfce2-e10a-42c6-8b7e-5fcc25d81ade
    Host: tester2.local
    Accept-Encoding: gzip, deflate, br
    Connection: keep-alive
    Cookie: PHPSESSID=f06cde50cb3bc3a0cc95650df21b3738
    

    When I am testing with curl, it works just fine and gives correct HTTP headers:

    curl -v http://tester2.local/api-v2/login
    *   Trying 10.10.10.1:80...
    * TCP_NODELAY set
    * Connected to tester2.local (10.10.10.1) port 80 (#0)
    > GET /api-v2/login HTTP/1.1
    > Host: tester2.local
    > User-Agent: curl/7.68.0
    > Accept: */*
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Date: Thu, 25 Nov 2021 14:24:39 GMT
    < X-Powered-By: PHP/7.4.13
    < Expires: Thu, 19 Nov 1981 08:52:00 GMT
    < Pragma: no-cache
    < cache-control: no-store, no-cache, must-revalidate, max-age=0
    < content-security-policy: frame-ancestors 'self'
    < Access-Control-Allow-Origin: http://localhost:5000
    < Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept, Origin, Authorization, Set-Cookie
    < Access-Control-Allow-Credentials: true
    < Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
    < Set-Cookie: PHPSESSID=ec28d265294aeda1817f0d1695b82393; path=/; domain=.tester2.local; HttpOnly
    < Content-Length: 11
    < Content-Type: application/json
    * Excess found in a read: excess = 27, size = 11, maxdownload = 11, bytecount = 0
    * Connection #0 to host tester2.local left intact
    {"ok":true}
              

    The same here. I'm trying this small php script under nginx which works fine via curl or hoppscotch but fails with postman.

    $ curl -vX POST http://localhost:8088/home/xyz/abc124
    *   Trying 127.0.0.1:8088...
    * Connected to localhost (127.0.0.1) port 8088 (#0)
    > POST /home/xyz/abc124 HTTP/1.1
    > Host: localhost:8088
    > User-Agent: curl/7.80.0
    > Accept: */*
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Host: localhost:8088
    < Date: Sun, 26 Dec 2021 22:04:06 GMT
    < Connection: close
    < x-header-one: Header Value 1
    < x-header-two: Header Value 2
    < content-type: application/json
    < content-length: 23
    * Closing connection 0
    {"some_data":223424234}
    

    The same here. I'm trying this small php script under nginx which works fine via curl or hoppscotch but fails with postman.

    $ curl -vX POST http://localhost:8088/home/xyz/abc124
    *   Trying 127.0.0.1:8088...
    * Connected to localhost (127.0.0.1) port 8088 (#0)
    > POST /home/xyz/abc124 HTTP/1.1
    > Host: localhost:8088
    > User-Agent: curl/7.80.0
    > Accept: */*
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Host: localhost:8088
    < Date: Sun, 26 Dec 2021 22:04:06 GMT
    < Connection: close
    < x-header-one: Header Value 1
    < x-header-two: Header Value 2
    < content-type: application/json
    < content-length: 23
    * Closing connection 0
    {"some_data":223424234}
    

    Correcting my previous comment.
    I was using a dev server and an old postman version.
    However if I use a latest postman like 9.6.1 as well as a proper server like Nignx my requests work with no this postman issue.

    Bug, when trying to send connection request to socket.io server through postman(last version on desktop the same):

    logs:

    [13194][1645654722816][main][error]["Postman Agent~Main~UncaughtException",{"name":"TypeError","message":"object null is not iterable (cannot read property Symbol(Symbol.iterator))","stack":"TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))\n at Socket.<anonymous> (/Applications/Postman Agent.app/Contents/Resources/app.asar/lib/common/services/SocketIOClient.js:190:15)\n at Object.onceWrapper (events.js:422:26)\n at Socket.emit (events.js:327:22)\n at addChunk (internal/streams/readable.js:309:12)\n at readableAddChunk (internal/streams/readable.js:284:9)\n at Socket.Readable.push (internal/streams/readable.js:223:10)\n at TCP.onStreamRead (internal/stream_base_commons.js:188:23)"}]

    (desktop clients shuts after this error)

    Responce:

    Could not connect to http://localhost:8080/admin
    00:23:13
    Error: Parse Error: Expected HTTP/
    Handshake Details
    Request URL: http://localhost:8080/api/v1/private/ws/?EIO=4&transport=websocket
    Request Method: GET
    Request Headers
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Key: qKBpW+sPUeQko22j38d6gw==
    Connection: Upgrade
    Upgrade: websocket
    Authorization: auth
    Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
    Host: localhost:8080

    Pls fix)))

    Same issue here

    When adding a this header to a server response: header('Content-Length: ' . strlen($fileContent)); - error in Postman
    Without this header and when opened in a browser - everything is ok

    curl --location --request POST 'http://localhost:3001/password-reset' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "reset-password": {
            "email": ""
    

    For me that was problem with wrong Content-Length header value. After fixing bug in which response body was wrongly counted everything works. (In my case I had CSV download type response and I didn't count table header names)

    Same issue w/ me, the server is replying with an incorrect content-length header value. I have no control over the server, so, ideally we'd have a way to do what curl is doing and just keep reading until we get the whole response?

    Here's my curl output:

    * Connected to 10.241.66.4 (10.241.66.4) port 443 (#0) * ALPN: offers h2 * ALPN: offers http/1.1 * (304) (OUT), TLS handshake, Client hello (1): * (304) (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 * ALPN: server did not agree on a protocol. Uses default. * Server certificate: * subject: C=US; ST=California; L=San Jose; O=Super Micro Computer; OU=Software; CN=IPMI * start date: Feb 25 00:00:00 2022 GMT * expire date: Feb 25 00:00:00 2025 GMT * issuer: C=US; ST=California; L=San Jose; O=Super Micro Computer; OU=Software; CN=IPMI * SSL certificate verify result: self signed certificate (18), continuing anyway. > PATCH /redfish/v1/Managers/1/NetworkProtocol HTTP/1.1 > Host: 10.241.66.4 > User-Agent: curl/7.86.0 > Accept: */* > Authorization: Basic XXXXXXX > Content-Type: application/json > Content-Length: 163 * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Content-Length: 86 < OData-Version: 4.0 < OData-Version: 4.0 < Content-Type: application/json; charset=utf-8 < Strict-Transport-Security: max-age=31536000; includeSubdomains < X-XSS-Protection: 1; mode=block < Content-Security-Policy: default-src 'self';connect-src 'self' ws: wss:;frame-src 'self' data:;img-src 'self' data:;object-src 'self';font-src 'self' data:;script-src 'self' 'unsafe-inline' 'unsafe-eval';style-src 'self' 'unsafe-inline';worker-src 'self' blob:; < X-Frame-Options: SAMEORIGIN < X-Content-Type-Options: nosniff < Date: Fri, 17 Mar 2023 09:55:40 GMT * Excess found in a read: excess = 202, size = 86, maxdownload = 86, bytecount = 0 * Closing connection 0 * TLSv1.2 (OUT), TLS alert, close notify (256): {"Success":{"code":"Base.v1_4_0.Success","Message":"Successfully Completed Request."}}% [BUG] send 127.0.0.1:50001 http request failed with httpyac vscode plugin, 50001 is special port for this problem AnWeber/vscode-httpyac#214

    I'm experiencing this when returning a 304 response from my server.

    ❯ curl -i -H "If-None-Match: RA_kwDOAzCBa84Hec-5" http://localhost:3000/releases/qc-ext.latest.meta.js
    HTTP/1.1 304 Not Modified
    etag: RA_kwDOAzCBa84Hec-5
    date: Tue, 12 Sep 2023 08:24:27 GMT
    ❯ curl --verbose -H "If-None-Match: RA_kwDOAzCBa84Hec-5" http://localhost:3000/releases/qc-ext.latest.meta.js
    *   Trying 127.0.0.1:3000...
    * Connected to localhost (127.0.0.1) port 3000 (#0)
    > GET /releases/qc-ext.latest.meta.js HTTP/1.1
    > Host: localhost:3000
    > User-Agent: curl/8.0.1
    > Accept: */*
    > If-None-Match: RA_kwDOAzCBa84Hec-5
    < HTTP/1.1 304 Not Modified
    < etag: RA_kwDOAzCBa84Hec-5
    < date: Tue, 12 Sep 2023 08:27:14 GMT
    * Connection #0 to host localhost left intact
    

    Postman says "Error: Parse Error: Expected HTTP/" on the same request