contrib: Respond with a fake well-known in the well-known-block
This commit is contained in:
parent
bd6d0e959a
commit
b6c89af7ea
|
@ -22,13 +22,37 @@ from mitmproxy import http
|
|||
|
||||
def request(flow):
|
||||
if flow.request.path == "/.well-known/matrix/client":
|
||||
flow.response = http.HTTPResponse.make(
|
||||
404, # (optional) status code
|
||||
b"Not found", # (optional) content
|
||||
{"Content-Type": "text/html"} # (optional) headers
|
||||
headers = http.Headers()
|
||||
headers.add("Content-Type", "application/json")
|
||||
|
||||
flow.response = http.Response.make(
|
||||
status_code=200, # (optional) status code
|
||||
content=json.dumps(
|
||||
{
|
||||
"m.homeserver": {"base_url": "https://localhost:8010/"},
|
||||
"org.matrix.msc2965.authentication": {
|
||||
"issuer": "https://localhost:8010",
|
||||
"account": "https://localhost:8010/account",
|
||||
},
|
||||
"org.matrix.msc3575.proxy": {"url": "https://localhost:8010"},
|
||||
}
|
||||
),
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
|
||||
# def request(flow):
|
||||
# if flow.request.path == "/.well-known/matrix/client":
|
||||
# headers = http.Headers()
|
||||
# headers.add("Content-Type", "application/json")
|
||||
#
|
||||
# flow.response = http.HTTPResponse.make(
|
||||
# status_code=404, # (optional) status code
|
||||
# content=b"Not found", # (optional) content
|
||||
# headers=headers,
|
||||
# )
|
||||
|
||||
|
||||
def response(flow: http.HTTPFlow):
|
||||
if flow.request.path == "/_matrix/client/r0/login":
|
||||
if flow.response.status_code == 200:
|
||||
|
|
Loading…
Reference in New Issue