Skip to content

Headers validated are case sensitive, while they shouldn't be. #201

Description

@victorlap

Currently when setting a required parameter in a header, you have to declare them in lowercase, or they will not be recognized by the RequiredFields validator.

Small example:

openapi: 3.0.3
[..]
paths:
  '/shopify/webhook/orders/paid':
    post:
      operationId: post-orders
      summary: Save Shopify Order
      description: 'Orders made through Shopify using the 2023-07 API version'
      tags:
        - Webhooks
      parameters:
        - name: X-Shopify-Shop-Domain
          in: header
          description: >
            The domain of the Shopify store that sent the webhook.
          required: true
          schema:
            type: string

Combined with a test like the following test:

    it('passes with required headers')
        ->postJson('/shopify/webhook/orders/paid', [], [
            'X-Shopify-Shop-Domain' => 'test.myshopify.com'
        ])
        ->assertValidRequest()
        ->assertValidResponse(200);

This test currently fails, because it's comparing X-Shopify-Shop-Domain to the psr7 normalized header value (x-shopify-shop-domain)

I don't think changing the RequiredFields validator is the way to go, since in other places it might be used where a case sensitive comparison is used, I think the best way forward is to normalize the header values before passing them to the validator.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions