The request works fine but the code doesn't

I’m sure this is a very broad category of error, and I’d like to learn how to isolate the problem myself, but I’ve got a request that runs fine in Postman. When I exported the code (PHP - HTTP_Request2), I got the OAuth2.0 working fine (modified to mint its own tokens as required) but instead of the expected 204 response, I’m getting a 400 response.

How do I even start to troubleshoot this?

What I’d like to do, is somehow capture both requests and compare them side by side, but I have no idea how to do that.

I’d love to just dump all the code so someone else can figure it out, but that’s probably the rudest thing a developer can do, so my code is only available upon request. (I’d still prefer to learn how to do it myself though.)

So, I can’t answer the other parts of your question @jonathonphilipchambe but I can answer this part:

Usually your would use some kind of tcp capture solutions on both the client and server side. I personally tend to use Wireshark for that. But you can use what every you like. You then can capture all the traffic that is coming and going on specific ip addresses and ports.

If you just want to get the postman side of things, lookup about the postman console. and you can get everything that is happening on the postman side and then on the “browser” side us the inspect of most of the common browsers … if you are using a non-standard browser use one of them just for this debugging.

Hope this helps on this section of it.

I ended up troubleshooting with postmanecho. Very handy tool. Turns out a lot of unnecessary /n, /r, and / were added, causing it to crash. (Likely bug for patching in the next update?) Anyway, I deleted them and it now works just fine.

1 Like