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

Allow user to override content type #24

Open
mefellows opened this issue Apr 21, 2023 · 2 comments
Open

Allow user to override content type #24

mefellows opened this issue Apr 21, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@mefellows
Copy link
Contributor

mefellows commented Apr 21, 2023

I'm writing a test for a Twirp client using this package, and have noticed it doesn't add the ;message=WhateverIAmSending parameter on the content type.

This results in the following failure:

  Mock server failed with the following mismatches:

	0) The following request was incorrect:

            	POST /twirp/twirp.example.haberdasher.Haberdasher/FindHat

			 1.0 Expected body with content type application/protobuf;message=FindHatRPC but was application/protobuf

In this case, the client is not configurable to override this, and it's not clear (at least to me) if this is the standard Twirp behaviour (perhaps it's a gRPC specific thing?), and so it seems it's not safe to assume this content-type.

@mefellows mefellows added the enhancement New feature or request label Apr 21, 2023
@rholshausen
Copy link
Contributor

Without the message=WhateverIAmSending attribute, there is no way to know which message from the proto descriptors to use (there could be multiple interactions in the Pact file for different messages).

@mefellows
Copy link
Contributor Author

Yeah, I can see the challenge. This does seem to require clients to change their behaviour though to suit the test framework (in this case, requiring them to add content-type attributes that aren't there by default), which in general I'm not a fan of.

Given that we know the current interaction(s) being tested at that moment, why must we encode that information into the content-type header and not just compare it to the expected protobuf definition provided in the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants