21

After encountering a throttle violation today (which I posted in another question), it occurred to me that although I've put together code to handle "backoff" conditions, and potentially throttle violation conditions (although I'm not sure what the response for this is, even) it would be nice to be able to generate these in a controlled fashion.

Does something like this exist? I'd want to be able to do something like:

/debug/backoff?time=30

Which would return a response containing a 30 second backoff request. If I violate it, it would return some error condition. This way I could make sure my implementation of the API calls handles this in a sane/acceptable fashion without violating the backoff condition. Not passing a time might cause a random backoff representing an "average" backoff.

Perhaps also:

/debug/throttle

Which would always return a throttle condition, regardless of the current state of my key. That way I could make sure I handle this situation in whatever way is appropriate.

I'm sure there's other things that would be of use for debugging, but offhand these two come to mind.

1
  • 4
    +1 None of my tests have ever seen the backoff parameter. My connection has way too much latency I think. Commented Jan 6, 2012 at 3:24

1 Answer 1

1

You can use Charles to simulate any response,

It has a free 30 day trial, for Windows, Mac and Linux.

Just set a breakpoint for http://api.stackexchange/* which breaks on Response (obviously you can't use it for https, so that means it can't be used for the routes which require authentication)

You can then edit the response, (as text, not in a fancy-JSON-editing-UI) to remove fields, including fields, or complete whatever you like. Click execute and the response is "received" by the computer like normal.

1
  • 4
    Yes, I was thinking I could also just set up my own debug service endpoints, but something integrated with the system would be slightly more ideal.
    – agent86
    Commented Jan 6, 2012 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .