Skip to content

Requests Problems [wiremock==2.6.1] #94

@Gadzillion

Description

@Gadzillion

Proposal

  1. In WireMock we have method
def create_mapping(cls, mapping, parameters={}):
    cls.validate_is_entity(mapping, Mapping)
    response = cls.REST_CLIENT.post(
        cls.get_base_uri(cls.endpoint()),
        json=mapping.get_json_data(),
        headers=make_headers(),
        params=parameters,
    )
    response = cls.REST_CLIENT.handle_response(response)
    return MappingResponse.from_dict(response.json())

response is

{
  "id" : "48fbcb6c-eb02-49cb-8f14-479271ddf4fa",
  "request" : {
    "url" : "rest_ab",
    "method" : "GET"
  },
  "response" : {
    "status" : 200,
    "jsonBody" : {
      "a" : 1
    }
  },
  "uuid" : "48fbcb6c-eb02-49cb-8f14-479271ddf4fa",
  "persistent" : false,
  "priority" : 100
}

in my code

res = Mappings.create_mapping(mappings=mapping)
res_j = res.to_json() # {} - it's empty

why ? i want to get full response body with uuid and etc

    headers = {
        'Content-type': 'application/json',
        'X-Request-Id': str(uuid.uuid4())
    }
    request = MappingRequest(method=method, url=url, headers=headers)
    Mappings.create_mapping(mapping=mapping)
wiremock.exceptions.invalid_input_exception.InvalidInputException: {
  "errors" : [ {
    "code" : 10,
    "source" : {
      "pointer" : "/request/headers/Content-type"
    },
    "title" : "Error parsing JSON",
    "detail" : "\"application/json\" is not a valid match operation"
  } ]
}

Reproduction steps

all in Proposal

References

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions