DEV Community

loading...

Can we change the status code of a HTTP request?

renee profile image Renée ・2 min read

Alt Text

Apart from using Breakpoint to edit content of requests/responses on the fly, this mini blog demonstrates how developers can use Proxyman Breakpoint to change the status code to test different cases of HTTP responses such as client error or server error.


Enable Breakpoint

After you have downloaded Proxyman and enable SSL Proxying for our testing domains, those requests/responses would be captured. Moreover, we can even use Breakpoint tool to manipulate those API calls as our testing purposes.

Enable SSL Proxying for testing domains

To enable this tool → Right Click the URL → select Tools → select Breakpoint

Right click URL → Select Tools → Select Breakpoint

Add Matching Rule

Then a Breakpoint Rule Window will pop-up so that we can define all matching conditions there. As Proxyman auto-use the selected endpoint as the condition, you would see the endpoint https://api.producthunt.com/v1… is auto-filled. Here we want to change the status code only so let’s uncheck the Request box

Uncheck Request box for modifying Response only

After hitting Done, we can see that new rule has been added up to the Breakpoint rules window

New Matching Rules is added after hitting Done button

With that all set up, it’s time to modify the status code to see how our app behaves

Change Status code

As soon as we re-send the request, that API call would be captured and a Breakpoints window would pop-up so that we can edit our queries on the fly.

Go to tab Other → change the status code as we want

The status code is separated into tab Other so you can go there and change as you want. As you can see, after changing the status code into 400 and hit Execute, the response is now updated with signal Error 400 in the main window

Alt Text

What’s next?

That’s how easy to use Breakpoint to modify status codes for testing purposes. We can also use this tool to manipulate the content of requests/ responses. Hope that you would find it helpful to boost productivity :)


Proxyman is a high-performance macOS app, which enables developers to view HTTP/HTTPS requests from apps and domains on iOS device, iOS Simulator and Android devices. Get it at https://proxyman.io

Discussion (0)

pic
Editor guide