- Issue created by @datawench
- Status changed to Closed: won't fix
4 months ago 5:26pm 24 July 2024 - πΊπΈUnited States datawench
Never mind. The token is getting in there, I'm just failing to handle the response properly. D'oh!
I seem to be having a devil of a time adding a custom header to the request.
Let's call the header PRIVATE-TOKEN
.
My service description is:
operations:
GetTheThing:
httpMethod: "GET"
uri: "part1/{id}/part2/{id2}/part3"
summary: "Get The Thing"
parameters:
id:
location: "uri"
required: true
type: "integer"
id2:
location: "uri"
required: true
type: "integer"
"PRIVATE-TOKEN":
location: "header"
type: "string"
responseClass: "getTheThingResponse"
... etc
In a Parameters class I define the local name of the token to be the API's name:
const PROJECT_ACCESS_TOKEN = 'PRIVATE-TOKEN';
In my extension of HttpRequestBase, I retrieve the argument:
public function getArgs(): array {
return [
// other params
Param::PROJECT_ACCESS_TOKEN => myFuncThatGetsEnv(),
];
}
I can debug here and see that the arg is correct.
In the class that extends HttpServiceWrapper base, Ireturn $this->callByRequest($request);
.
This all finally makes it into the guzzle client, where I can see my token in the args. But it doesn't seem to get into the header, so my request never authenticates. And actually debugging directly to examine the final, real request that's being sent isn't trivial.
Am I doing something fundamentally wrong here?
Closed: won't fix
10.0
Documentation
Never mind. The token is getting in there, I'm just failing to handle the response properly. D'oh!