Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3370
Closed
Open
Issue created Jul 15, 2019 by Administrator@rootContributor

[Java rest-assured] reqSpec is reused across multiple requests

Created by: jmini

Given this spec:

openapi: 3.0.1
info:
  title: ping test
  version: '1.0'
servers:
  - url: 'http://localhost:8080/'
paths:
  /ping:
    get:
      operationId: pingGet
      tags:
       - lorem
      parameters:
       - in: query
         name: q
         schema:
           type: string
       - in: query
         name: r
         schema:
           type: string
      responses:
        '201':
          description: Ok

Adjust the generated test src/test/java/org/openapitools/client/api/LoremApiTest.java to:

    @Test
    public void shouldSee201AfterPingGet() {
        String q1 = "param1";
        api.pingGet().qQuery(q1).execute(r -> r.prettyPeek());
        
        String q2 = "param2";
        String r2 = "param2";
        api.pingGet().qQuery(q2).rQuery(r2).execute(r -> r.prettyPeek());
    }

(Do not forget to remove the generated @Ignore annotation on top of the unit-test class)


Run the test against a server where you can have a look at the requests.

The server is receiving this logs:

First request:

[GET] /ping?q=param1

Second request:

[GET] /ping?q=param1&q=param2&r=param2

Having two q params in the second request is wrong!

My analysis is that this is because reqSpec is reused between calls and it should not be the case.

Assignee
Assign to
Time tracking