You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a custom header which has a key such as "APP_AUTH" and I'd like to keep this key in the pact contract. However, I believe pact-mock_serivce helps me reformat the custom header to be "App-Auth" and breaks the contract on the provider side.
After look around the source code with my bad ruby knowledge. I believe the source code is under pact-mock_service/lib/pact/consumer/mock_service/rack_request_helper.rb
line 47:
def standardise_header header
header.gsub(/^HTTP_/, '').split("_").collect{|word| word[0] + word[1..-1].downcase}.join("-")
end
Would you please tell me whether I can still keep the original contract format rather than to standardise it? I know "APP_AUTH" maybe is not a good name, however it's have been used by a lot of services which we can not easily modify.
Thanks for your help and looking forward to your reply. :)
The text was updated successfully, but these errors were encountered:
calvinlyc
changed the title
Custom Header Reformat...?
Custom Header Key name reformat by mock service?
Feb 11, 2016
That's a tricky one. The code that you have found converts the Rack headers into HTTP headers. You can read about Rack headers here: http://www.rubydoc.info/github/rack/rack/file/SPEC There's no configuration to ignore particular headers unfortunately.
If you want to keep APP_AUTH, I'd recommend monkey patching that method to ignore that particular header ;) It's an unusual corner case, not really one that I particularly want to add support for.
We have a custom header which has a key such as "APP_AUTH" and I'd like to keep this key in the pact contract. However, I believe pact-mock_serivce helps me reformat the custom header to be "App-Auth" and breaks the contract on the provider side.
After look around the source code with my bad ruby knowledge. I believe the source code is under pact-mock_service/lib/pact/consumer/mock_service/rack_request_helper.rb
line 47:
def standardise_header header
header.gsub(/^HTTP_/, '').split("_").collect{|word| word[0] + word[1..-1].downcase}.join("-")
end
Would you please tell me whether I can still keep the original contract format rather than to standardise it? I know "APP_AUTH" maybe is not a good name, however it's have been used by a lot of services which we can not easily modify.
Thanks for your help and looking forward to your reply. :)
The text was updated successfully, but these errors were encountered: