ArchGPT / insomnium

Insomnium is a fast local API testing tool that is privacy-focused and 100% local. For testing GraphQL, REST, WebSockets and gRPC. This is a fork of Kong/insomnia
MIT License
3.3k stars 123 forks source link

DELETE method with 302 redirect causes second DELETE request #150

Open halfnibble opened 4 months ago

halfnibble commented 4 months ago

Expected Behavior

I expect a DELETE request with a redirect response to successfully redirect and load the GET response body

Actual Behavior

After the GET redirect response, another DELETE request is made to the redirect path causing an error.

DELETE http://localhost:3003/breads/0

Full history

* Preparing request to http://localhost:3003/breads/0
* Current time is 2024-02-09T05:26:47.099Z
* Enable automatic URL encoding
* Using default HTTP version
* Enable timeout of 30000ms
* Disable SSL validation
* Enable cookie sending with jar of 1 cookie
* Connection 3 seems to be dead!
* Closing connection 3
* Hostname in DNS cache was stale, zapped
*   Trying 127.0.0.1:3003...
* Connected to localhost (127.0.0.1) port 3003 (#4)

> DELETE /breads/0 HTTP/1.1
> Host: localhost:3003
> Content-Type: application/json
> User-Agent: insomnium/0.2.3
> Accept: */*
> Content-Length: 217

| {
|   "name": "SpryRye",
|   "hasGluten": true,
|   "image": "https: //images.unsplash.com/photo-1595535873420-a599195b3f4a?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80"
| }

* Mark bundle as not supporting multiuse

< HTTP/1.1 302 Found
< X-Powered-By: Express
< Location: /breads
< Vary: Accept
< Content-Type: text/plain; charset=utf-8
< Content-Length: 29
< Date: Fri, 09 Feb 2024 05:26:47 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5

* Ignoring the response-body
* Received 29 B chunk
* Connection #4 to host localhost left intact
* Issue another request to this URL: 'http://localhost:3003/breads'
* Switch from POST to GET
* Found bundle for host localhost: 0x11157d300 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#4) with host localhost
* Connected to localhost (127.0.0.1) port 3003 (#4)

> DELETE /breads HTTP/1.1
> Host: localhost:3003
> Content-Type: application/json
> User-Agent: insomnium/0.2.3
> Accept: */*

* Mark bundle as not supporting multiuse

< HTTP/1.1 404 Not Found
< X-Powered-By: Express
< Content-Security-Policy: default-src 'none'
< X-Content-Type-Options: nosniff
< Content-Type: text/html; charset=utf-8
< Content-Length: 148
< Date: Fri, 09 Feb 2024 05:26:47 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5

* Received 148 B chunk
* Connection #4 to host localhost left intact

Reproduction Steps

  1. git clone https://github.com/halfnibble/bread-crud-24
  2. git checkout e6056acbb7fad429b24f635f33c056ca21a8f8f7
  3. npm install
  4. touch .env
  5. echo "PORT=3003" > .env
  6. node index.js
  7. Make a DELETE request on http://localhost:3003/breads/0

Is there an existing issue for this?

Additional Information

No response

Insomnium Version

0.2.3-a

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.2.1

Installation method

Download signed dmg from release

Last Known Working Insomnium version

NA

halfnibble commented 4 months ago

Note: the history log is from a 302 redirect, but the same thing happens with 303.

I realize it may be controversial to redirect a DELETE request, but I'd like to point out that Postman supports it.