usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
22.16k stars 1.04k forks source link

Display all request headers in Timeline tab #645

Open jackc opened 9 months ago

jackc commented 9 months ago

I have a Rails API. I've been using curl to for ad hoc testing, but just tried using Bruno. Unfortunately, the experience was very confusing.

A Rails API that only handles json will typically work with or without an "Accept: application/json" header. So when using curl I do not include it. I did the same thing with Bruno and received an HTTP 406 Not Acceptable. I was unable to find any difference in the Bruno UI. However, I then pointed Bruno at a netcat listener so I could see exactly what was going over the wire. It is sending a default header of accept: application/json, text/plain, */*.

Further digging revealed that Rails treats any accept header including */* as coming from a browser and essentially overrides the accept header to only respond with html. (https://github.com/rails/rails/issues/40908 and https://github.com/rails/rails/blob/ae6fa7a048d0a0f79b0f8dd8566c7d499fd6f616/actionpack/lib/action_dispatch/http/mime_negotiation.rb#L171)

The underlying issue was with Rails. However, it was more difficult to diagnose because Bruno does not appear to expose all the actual request headers. The "Timeline" tab appears to show request headers, but it actually only shows the explicitly set headers. This was misleading. I wasn't expecting an accept header to be set at all, but it was happening invisibly.

Perhaps all request headers could be displayed in the Timeline view.

pete-mantell-giffgaff commented 7 months ago

I'd like this too - or alternatively extra tabs on the RHS which show actual request body & headers sent (i.e. after all scripts, vars, etc are evaluated) to assist with diagnosis

palhal commented 5 months ago

Yes, this is a must-have in my opinion. I'm currently debugging why the API behaves differently when using Bruno vs. application code. Then it's crucial to know all headers that are sent.

bannmann commented 4 months ago

Same here. I was curious what the user agent value sent by Bruno was. Another use case I had a few months ago (in Insomnia) is debugging a problem with cookies.

Bruno should follow Insomnia's lead here and simply display all headers with their final values in the timeline tab.