def object_to_form(self, mocked_response: MockedResponse):
     self.parent_view.chk_mock_response_enabled.setChecked(
         mocked_response.is_enabled)
     self.parent_view.txt_mocked_response_code.setText(
         str(mocked_response.status_code))
     self.mocked_response_headers_presenter.update_items(
         mocked_response.headers)
     self.parent_view.txt_mocked_response_body.clear()
     self.parent_view.txt_mocked_response_body.appendHtml(
         highlight_format_json(mocked_response.body))
Example #2
0
def markdown_request(exchange: HttpExchange):
    http_url = exchange.request.full_encoded_url

    request_headers = dict_formatter(exchange.request.headers.items(),
                                     "{k}: {v}",
                                     splitter="\n")

    formatted_request_body = highlight_format_json(
        exchange.request.request_body, formatter=NullFormatter())

    return f"""
Example #3
0
def markdown_response(exchange: HttpExchange):
    elapsed_time = elapsed_time_formatter(exchange.response.elapsed_time)
    if exchange.response.is_mocked:
        elapsed_time = "Mocked Response"

    response_headers = dict_formatter(exchange.response.headers.items(),
                                      "{k}: {v}",
                                      splitter="\n")

    formatted_response_body = highlight_format_json(
        exchange.response.response_body, formatter=NullFormatter())
    return f"""