hulu / roku-dev-cli

A command-line developer tool for loading Roku builds
Apache License 2.0
26 stars 8 forks source link

feat(cli): Add --web option to use `mitmweb` instead of `mitmdump` #11

Closed sjbarag closed 5 years ago

sjbarag commented 5 years ago

The mitmweb interface is much more useful for interactive debugging than the mitmdump version, so let's make it available easily!

closes #10

sjbarag commented 5 years ago

This looks like a good change. I vaguely recall there was some nuance to scripts in mitmweb, but can't remember any examples. Please test an example script to make sure it works.

Good point! I just tested a very simple outside of this CLI to test mitmweb:

class ExampleError:
    def response(self, flow):
        request = flow.request
        response = flow.response

        if "example.com" in request.host_header:
            response.status_code = 500
            response.text = "mitmweb sent me"

addons = [ExampleError()]

Run mitmweb -s /path/to/example-error.py, configure Firefox to use localhost:8080 as its proxy, and load example.com (you may need a cache-busting refresh). You'll receive a 500 error and the mitmweb sent me message!