You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitmproxy2swagger/testdata/generic_keys_testserver.py

33 lines
818 B

# -*- coding: utf-8 -*-
import json
from testserver import TestServerHandler, launchServerWith
class GenericKeysHandler(TestServerHandler):
def transform_data(self, raw_data):
data = json.loads(raw_data)
data["numeric"]["0000"] = {
"lorem": "ipsum",
"dolor": "sit",
"amet": "consectetur",
}
data["uuid"]["123e4567-e89b-12d3-a456-426614174002"] = {
"lorem": "ipsum",
"dolor": "sit",
"amet": "consectetur",
}
data["mixed"]["0000"] = {
"lorem": "ipsum",
"dolor": "sit",
"amet": "consectetur",
}
# Encode the modified data
return bytes(json.dumps(data), "utf-8")
if __name__ == "__main__":
launchServerWith(GenericKeysHandler)