Skip to content

Commit

Permalink
provide reason in playback response
Browse files Browse the repository at this point in the history
  • Loading branch information
flashdagger committed Oct 16, 2023
1 parent 2eb4496 commit d579436
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: UTF-8 -*-

import os.path
from http.client import responses
from pathlib import Path
from typing import Any, Dict, Generator
from unittest.mock import patch
Expand Down Expand Up @@ -122,7 +123,9 @@ def replay_request(_self, method, url, *_args, **kwargs):
key = serialize(method, url, params)
status, content = recorder[key].split(maxsplit=1)
response = Response()
response.status_code = int(status)
status_code = int(status)
response.status_code = status_code
response.reason = responses[status_code]
response._content = content.encode()

return response
Expand Down

0 comments on commit d579436

Please sign in to comment.