Skip to content

[BUG][cpp-restsdk]How to define login API to return cookie from response header for cpp-restsdk generator #8990

Open
@himadree-shekhar

Description

@himadree-shekhar
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

Steps to reproduce
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions