Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specmatic not sending Cookie in API calls even when it is a required param #1289

Open
sumityadav29 opened this issue Sep 11, 2024 · 1 comment

Comments

@sumityadav29
Copy link

Description
Specmatic does not send Cookie in the API calls even when it is a required parameter for the API. This leads to failure of API call and ultimately of the specmatic API contract test even when the implementation is actually respecting the contract

I suspect this is happening because of dynamic http headers being removed the request but I can be wrong

I have tried adding an example for the param like below but still no luck

        - name: session_id
           in: cookie
           required: true
           schema:
             type: string
           description: A required cookie parameter that contains the session ID.
           examples:
             syn_200:
               value: 1234

Steps to reproduce
run specmatic contract test on an api spec which contains required Cookie param for a path

example opeanapi spec

openapi: 3.0.3
info:
  title: TODO API
  description: API to retrieve a list of TODO items, requiring a cookie for authentication.
  version: 1.0.0
paths:
  /todos:
    get:
      summary: Get a list of TODO items
      description: Retrieves a list of TODO items. Requires a valid session cookie for authentication.
      parameters:
        - name: session_id
          in: cookie
          required: true
          schema:
            type: string
          description: A required cookie parameter that contains the session ID.
      responses:
        '200':
          description: A list of TODO items
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    title:
                      type: string
                    completed:
                      type: boolean
              examples:
                example-success:
                  summary: Successful TODO list retrieval
                  value:
                    - id: 1
                      title: "Buy groceries"
                      completed: false
                    - id: 2
                      title: "Pay utility bills"
                      completed: true

Expected behavior
I am expecting the Cookie param to be sent in the API call just like query and path params

System Information:

  • OS & version: MacOS 14.3
  • Specmatic version: 2.0.17
  • JDK version: 21
@pranavgawri
Copy link

Hi, @sumityadav29

Thanks for sharing the details, we will check and get back to you asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants