Open
Description
Description
I want to write a API for login request.
If the login request is successful then it API should return the cookie from the response header.
openapi-generator version 5.0.1
OpenAPI declaration file content or url
/api/v1/user/login:
post:
tags:
- login/logout
summary: Login as a user.
description: Send login request
operationId: loginUser
requestBody:
description: Send login credentials.
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
username:
type: string
password:
type: string
required:
- username
- password
example:
username: usr
password: '123'
responses:
'200':
description: returns cookie from header.
content:
text/html:
schema:
type: string
tags:
- name: login/logout
description: 'login, logout operations'
Generated Code:
The generated API function, it only returns the HTTP body instead of the extracting cookie from the header:
return localVarResponse.extract_string();
So, How can we get the cookie.
Generation Details
npx openapi-generator-cli generate -g cpp-restsdk -i test.yaml -o ./cpp