Git Product home page Git Product logo

mitmproxy-mock's People

Contributors

0neel avatar arkku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mitmproxy-mock's Issues

is it possible to provide the mock config as a folder that contains multiple files instead of one single file

Firstly , I would like to thank you to produce this very great and easy to use work for community.

I have a quick question regarding mock configuration

background:
currently we're using mitmproxy-mock in our test scenario and we have multiple cases which need to be mock differently
my aim is to separate the mock config to be multiple files per test cases so, that the maintainer can easily find the right place when there is the changes need to be done.

question:
as i check , right now it is support only 1 single file to be mock config, Is it possible to support multiple file in same folder ?

Best,
Oz

Is it possible to replace request path using a regex?

I use the below config to modify a request path. Is it possible to use a regex in the modify block to get the digits from the middle of the url and move them to the end? Can't really find an answer in the docs. I'm guessing some variant of replace?

    "~^/api/foo/\\d+/bar": {
      "modify":{
        "path": "/api/foo/bar/14"
      }
    }

wolt

Can i ask to reverse me to israel [email protected].
Have some prob with ubuntu linux security.
I was tried to write project on jquery and javascript ... but some how my iptable with ipsec/ikev2 was unlocked.

Mocked request with response fails if host cannot be resolved.

Subject of the issue

The mocked request fails if the target host does not exist.

According to the doc
A request handler is triggered when the client makes a request. This occurs before anything is sent to the server

In practice it seems the host gets somehow resolved

Expected behaviour

In case of a match the request returns with value regardless the host.

Actual behaviour

Error message

502 Bad Gateway

ProtocolException('Server connection to (\'nodomain123.com\', 443) failed: Error connecting to "nodomain123.com": [Errno 111] Connection refused')

Steps to reproduce

Use the following config.

mitmproxy -s moxy.py --set mock=config/example.json

{ 
 "request": {
   "/part1/part2/part3": {
     "respond": {
       "content": {
         "foo": 15,
         "bar": "M5",
       }
     }
   }
 }
}

export https_proxy="http://127.0.0.1:8080"
curl https://nodomain123.com/part1/part2/part3 # fails
curl https://google.com/part1/part2/part3 # works

Question: How to mock server response from an URL?

I doubt everyone will read this and I don't know if this belongs here, but I need a bit of an advice and I'm having quite a hard time figuring this out as JS seems a bit painful to me. Say, we send a typical GET request to an URL, like https://www.example.com/ with some string (doesn't matter what it is) and we receive the respond from the real server: "example string". How could I use mitmproxy-mock to now "catch" this certain HTTP response and, say, change the said string to a different string, like "oh that's my own!" ?
@arkku
@0neel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.