question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cache requests/response.

See original GitHub issue

I use mitmproxy a lot for developing scripts that scrap external content. I often find that it takes a long time to test script because it needs to repeat all the HTTP requests. It would be nice if it was able to select HTTP requests that mitmproxy would cache and use cached version to reply to the user.

The most common use case scenario is GET requests because those are supposed to be immutable.

I have built a node web-proxy script to do this for me, using it as a forward proxy together with mitmproxy, though it would be nice if mitmproxy supported this natively.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
colin-devcommented, Sep 21, 2016

@gajus, I recorded a session into a file and was able to repeatedly return the results using the --no-pop parameter mitmproxy -S /sites/dsi.site --no-pop The responses live in a queue, which is why the responses are only replayed once, the --no-pop command tells mitmproxy to leave the responses in a queue so they can be returned ad-infinitum

0reactions
gajuscommented, Sep 20, 2016

I am sure you are able to do it using mitmproxy with a bit of Python skills, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP caching - MDN Web Docs
The HTTP cache stores a response associated with a request and reuses the stored response for subsequent requests.
Read more >
Prevent unnecessary network requests with the HTTP Cache
All HTTP requests that the browser makes are first routed to the browser cache to check whether there is a valid cached response...
Read more >
Caching REST API Response
Caching is the ability to store copies of frequently accessed data in several places along the request-response path.
Read more >
What is Cache-Control and How HTTP Cache Headers Work
What is the Cache-Control Header. Cache-control is an HTTP header used to specify browser caching policies in both client requests and server responses....
Read more >
requests-cache 0.9.7 documentation
Ease of use: Keep using the requests library you're already familiar with. · Performance: Get sub-millisecond response times for cached responses. ·
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found