forked from loafle/openapi-generator-original
* Update apiInvoker.mustache In scala-akka-client code that is getting generated, addAuthentication method is called after setting headers using header parameter in the below mentioned line addAuthentication(request.credentials)( httpRequest.withHeaders(headers(request.headerParams)) ) However, in addAuthentication method, we are using withHeaders method that overwrites the headers set using header parameters. So, I am proposing to change the addAuthentication method be replacing withHeaders() method to addHeader() to add authentication header to the list of already existing headers. * Update ApiInvoker.scala Added changes to sample for the client generator code change
This commit is contained in:
parent
fff5bfe8cb
commit
7bb8a8d9ff
@ -103,11 +103,11 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends CustomC
|
|||||||
request: HttpRequest =>
|
request: HttpRequest =>
|
||||||
credentialsSeq.foldLeft(request) {
|
credentialsSeq.foldLeft(request) {
|
||||||
case (req, BasicCredentials(login, password)) =>
|
case (req, BasicCredentials(login, password)) =>
|
||||||
req.withHeaders(Authorization(BasicHttpCredentials(login, password)))
|
req.addHeader(Authorization(BasicHttpCredentials(login, password)))
|
||||||
case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
||||||
req.withHeaders(RawHeader(keyName, keyValue.value))
|
req.addHeader(RawHeader(keyName, keyValue.value))
|
||||||
case (req, BearerToken(token)) =>
|
case (req, BearerToken(token)) =>
|
||||||
req.withHeaders(RawHeader("Authorization", s"Bearer $token"))
|
req.addHeader(RawHeader("Authorization", s"Bearer $token"))
|
||||||
case (req, _) => req
|
case (req, _) => req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,11 +113,11 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends CustomC
|
|||||||
request: HttpRequest =>
|
request: HttpRequest =>
|
||||||
credentialsSeq.foldLeft(request) {
|
credentialsSeq.foldLeft(request) {
|
||||||
case (req, BasicCredentials(login, password)) =>
|
case (req, BasicCredentials(login, password)) =>
|
||||||
req.withHeaders(Authorization(BasicHttpCredentials(login, password)))
|
req.addHeader(Authorization(BasicHttpCredentials(login, password)))
|
||||||
case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
||||||
req.withHeaders(RawHeader(keyName, keyValue.value))
|
req.addHeader(RawHeader(keyName, keyValue.value))
|
||||||
case (req, BearerToken(token)) =>
|
case (req, BearerToken(token)) =>
|
||||||
req.withHeaders(RawHeader("Authorization", s"Bearer $token"))
|
req.addHeader(RawHeader("Authorization", s"Bearer $token"))
|
||||||
case (req, _) => req
|
case (req, _) => req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user