Do not capitalize method value. It causes confusion when editing requ… by gachikuku · Pull Request #7808 · mitmproxy/mitmproxy

@gachikuku

Description

Do not capitalize HTTP methods after editing.
It causes confusion and it's not reflecting the true state of the request being sent.

Checklist

  • I have added an entry to the CHANGELOG.
  • I have updated tests where applicable.

@lups2000

It causes confusion and it's not reflecting the true state of the request being sent.

Hi, could you elaborate more on this with more details? thanks! At first glance, it doesn't make sense to me to remove the .upper().

@gachikuku

I would post this pentesterlab as a demo.

Screen.Recording.2025-07-22.at.22.33.42.mov

At first glance you cannot tell what's the difference,
but in the reality this is what happens after the fix.
Screenshot 2025-07-22 at 22 36 05

@lups2000

Sorry, but I still don't get where the problem is. Could you write down the exact steps to reproduce the issue? Thanks :)

@gachikuku

Sure! Sorry if I was not clear

  • Pick a request and change the HTTP method to anything.
    For example from GET to post.
  • After editing, the request from GET to post,
    the method or verb gets displayed as POST NOT post.
  • It should have been displayed as post since we changed it to post not POST.
  • After exporting the raw_request only there post is displayed instead of POST.

I find out only after I exported the raw_request and saw what was actually happening.

Please don't hesitate to ask me for further clarification, and thank you in advance.

@gachikuku

Maybe is a console issue? I don't know but when I deleted .upper()
then the HTTP method was displayed with the correct capitalization.

@lups2000

Ah, I see now. Yes, there is some confusion when we export the raw content. Maybe we should just stick with the uppercase version there as well. As far as I’ve seen, the request method is always displayed in uppercase.

@gachikuku

I don't think we should stick to uppercase there as well.

Let the user decide the letter case :)

@gachikuku

Exactly, the request method is always displayed in uppercase, but it's not actually whats being send if the user types the method with lowercase

@gachikuku

The exported raw_request reflects whats the actual request being sent.

@lups2000

Let the user decide the letter case :)

Okay I am fine with that! Then you should just fix the tests :) let's see if also @mhils and @Prinzhorn agree with this approach!

@gachikuku

@mheguy

There are a lot of comparisons in the codebase that involve method.
It would be a good idea to validate which of them might need to call .upper for those comparisons.

@gachikuku

@mheguy I wouldn't mind if you want to do that!