question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pact client doesn't send DELETE requests with body correctly

See original GitHub issue

Software versions

  • OS: Windows 10
  • Library version: 9.0.4
  • Node Version: 10.15.3

Expected behaviour

Pact mock client during pact provider tests should send HTTP DELETE requests with HTTP body correctly.

Actual behaviour

It doesn’t send HTTP DELETE requests correctly.

I’m using Node.js with Express framework as the server, and I’m running pact provider tests / pact verifications. One of the pact interactions is a DELETE request that has a request body (The spec does not forbid it). All other requests go through fine, but the delete request seemingly makes the server freeze and not return anything until the timeout, at which it resets the HTTP connection (see the pact provider log attached).

Upon further investigation with Wireshark I found out the underlying problem: the pact mock client doesn’t even send all of the TCP packets that make up the HTTP DELETE request - it stops short of sending the body. This makes the server wait for the remaining packet, which never comes, thus hanging the test until it times out.

image

Interestingly, it does send Content-Length: 15 in the first packet, indicating that there will be a body in the following packet(s), but it never sends it.

Steps to reproduce

Try to verify a pact with the following interaction:

{
      "description": "A DELETE request to delete one reminder",
      "providerState": "User user1@example.com exists with 2 smart reminders",
      "request": {
        "method": "DELETE",
        "path": "/api/users/22/schedule",
        "headers": {
          "Content-Type": "application/json",
        },
        "body": {
          "items": [
            100
          ]
        }
      },
      "response": {
        "status": 204,
        "headers": {
        }
      }
    }

(or any pact that has a HTTP DELETE method with a request body).

Relevant log files

Log file generated by pact provider test attached. pact-provider.log

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jnazandercommented, Sep 19, 2019
0reactions
bethesquecommented, Dec 17, 2019

Someone else had this issue recently, and I told them I didn’t think it could be fixed. Will have to do a search of all the issues and try and track it down.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pact client doesn't send DELETE requests with body correctly
It doesn't send HTTP DELETE requests correctly. I'm using Node.js with Express framework as the server, and I'm running pact provider tests / ......
Read more >
Is an entity body allowed for an HTTP DELETE request?
A client SHOULD NOT generate content in a DELETE request unless it is made directly to an origin server that has previously indicated,...
Read more >
FAQ | Pact Docs
You can find the answers to some more technical and complex questions here.
Read more >
How to Use Swagger Inspector
Select HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD,. To the right of the method option is the URI input. Choose the base...
Read more >
SOAP vs REST APIs: Which Is Right For You? - SoapUI
Just because our name is SoapUI, doesn't mean that we also don't know what we are talking ... Your basic REST HTTP requests...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found