bruno icon indicating copy to clipboard operation
bruno copied to clipboard

When specifying "No Body" a Content-Type header is still sent

Open jsonfry opened this issue 11 months ago • 3 comments

When doing a POST, PUT, or PATCH with the "No Body" option selected, a Content-Type header is sent with the value of application/x-www-form-urlencoded.

There should be no content type header sent

jsonfry avatar Feb 29 '24 10:02 jsonfry

Can you check if this issue is happening in the latest version of Bruno, @jsonfry?

sanjai0py avatar Apr 11 '24 13:04 sanjai0py

Got same issue using bruno v1.13.1 running on ubuntu (using apt repository release)

orgrimarr avatar Apr 22 '24 15:04 orgrimarr

Yes, still a probelm on 1.14.0.

Here's a simple Python server that responds with the request headers as the body:

from http.server import BaseHTTPRequestHandler, HTTPServer

class RequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        self._print_headers()

    def do_POST(self):
        self._print_headers()

    def _print_headers(self):
        self.send_response(200)
        self.send_header('Content-type', 'text/plain')
        self.end_headers()
        for header, value in self.headers.items():
            self.wfile.write(f"{header}: {value}\n".encode('utf-8'))

def run(server_class=HTTPServer, handler_class=RequestHandler, port=8000):
    server_address = ('', port)
    httpd = server_class(server_address, handler_class)
    print(f"Server running on port {port}")
    httpd.serve_forever()

if __name__ == "__main__":
    run()

And here it is running, notice the returned header value for Content-Type, even though "no body" is selected:

Screenshot 2024-04-26 at 12 18 01

jsonfry avatar Apr 26 '24 11:04 jsonfry