Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests Problems [wiremock==2.6.1] #94

Open
Gadzillion opened this issue Sep 7, 2023 · 0 comments
Open

Requests Problems [wiremock==2.6.1] #94

Gadzillion opened this issue Sep 7, 2023 · 0 comments
Assignees
Labels

Comments

@Gadzillion
Copy link

Gadzillion commented Sep 7, 2023

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

@Gadzillion Gadzillion added the bug label Sep 7, 2023
@Gadzillion Gadzillion changed the title Requests Problems Requests Problems [wiremock=2.6.1] Sep 7, 2023
@Gadzillion Gadzillion changed the title Requests Problems [wiremock=2.6.1] Requests Problems [wiremock==2.6.1] Sep 7, 2023
@oleg-nenashev oleg-nenashev self-assigned this Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants