GitHub
12/21/2023, 11:42 PM"consumer": {
"name": "Consumer"
},
"interactions": [
{
"description": "a request for bookings count",
"providerStates": [
{
"name": "A user exists",
"params": {
"email": "<mailto:contract@mail.com|contract@mail.com>"
}
}
],
"request": {
"generators": {
"header": {
"$['se-token'][0]": {
"expression": "${seToken}",
"type": "ProviderState"
}
},
"path": {
"expression": "/v4/users/${userId}/bookings/count",
"type": "ProviderState"
}
},
"headers": {
"se-api-token": "156806cc-80cf-449d-b0ca-86c9252a36a1",
"se-token": "ABC123"
},
"method": "GET",
"path": "/v4/users/1234/bookings/count"
},
"response": {
}
}
],
"metadata": {
"pact-js": {
"version": "11.0.2"
},
"pactRust": {
"ffi": "0.4.0",
"models": "1.0.4"
},
"pactSpecification": {
"version": "3.0.0"
}
},
"provider": {
"name": "Provider"
}
}
When I run the tests for the provider, the status change url gets called as expected and it returns the required values, userId and seToken. These values are properly interpolated in the path, so my server receives a hit in the right url (/v4/users/${userId}/bookings/count), but the headers are not properly set in the request, so in my server logs I see:
Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: The HTTP header line [$['se-token'][0]: eyJhbGciOiJSUzI1NiJ9.eyJ] does not conform to RFC 7230 and has been ignored.
at org.apache.coyote.http11.Http11InputBuffer.skipLine(Http11InputBuffer.java:1093)
at org.apache.coyote.http11.Http11InputBuffer.parseHeader(Http11InputBuffer.java:922)
at org.apache.coyote.http11.Http11InputBuffer.parseHeaders(Http11InputBuffer.java:604)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:294)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:750)
If I modify my pact file to be
"request": {
"generators": {
"header": {
"se-token": {
"expression": "${seToken}",
"type": "ProviderState"
}
},
Then, everything works as expected, but with the generated pact file it's taking $['se-token'][0] as the headers name instead of just se-token.
I am using version gradle plugin version 4.1.42 .
```
pact-foundation/pact-jsGitHub
01/17/2024, 3:22 AM