[Twisted-Python] Injecting 400 errors via HTTP Proxy

Adi Roiban adi at roiban.ro
Sat Dec 5 06:52:20 MST 2020


Hi Vlad

On Fri, 4 Dec 2020 at 02:11, Vlad Petric <vlad at petric.cc> wrote:

> Hi Everyone,
>
> I'd like to randomly inject 400 errors via the HTTP Proxy.
>
> I'm testing the robustness of an application that performs a lot of HTTP
> GETs. I am using the basic http web proxy, and  I need to modify it to
> randomly insert some errors.
>
> Should I be using my own class derived from ProxyRequest, and override
> process()? If that's the case, how would I be injecting 400s?
>
> Thank you so much!
> Vlad, a twisted n00b
> _______________________________________________
>

Is this a forward or reverse proxy?

ProxyRequest is just like any request... you can set headers, response
code, write content to it...

Here is an example:

https://gist.github.com/adiroiban/ef9dfd2cce5c59b70e1bc0600b58adeb

-- 
Adi Roiban
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20201205/d7063484/attachment.htm>


More information about the Twisted-Python mailing list