Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing HAR does not always show the correct status code (200 instead of 4xx) #176

Open
android-t709 opened this issue Sep 2, 2024 · 0 comments

Comments

@android-t709
Copy link

I'm using mitmproxy2swagger 0.13.0 to parse .har files generated by HTTP toolkit. I noticed that all the API endpoints showed 200 OK in the examples.
This seems to be because the code tries to parse the response as json (or msgpack)

response_body = req.get_response_body()
if response_body is not None:
# try parsing the response as json

get_response_body is often

return self.flow["response"]["content"]["text"]

I tested this also with chrome, to get 404/400 codes in a .har.
Anyway, when the response body isn't json, the default response code of 200 is given. This happened a few times on 400 Bad Request on an API I was testing.
I'm not sure if this works differently with mitmproxy vs chrome, and this certainly isn't a priority for me. I just thought it was worth noting because it tripped me up a little.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant