Skip to content

Return headers() as associative array #361

@danielsippel

Description

@danielsippel

I followed your steps here:
https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md

var_dump($response->headers());

array:15 [
  0 => "HTTP/1.1 202 Accepted\r"
  1 => "Server: nginx\r"
  2 => "Date: Wed, 22 Feb 2017 14:14:30 GMT\r"
  3 => "Content-Type: text/plain; charset=utf-8\r"
  4 => "Content-Length: 0\r"
  5 => "Connection: keep-alive\r"
  6 => "X-Message-Id: rL5XOoCUSkm-0sH4CLipBx\r"
  7 => "X-Frame-Options: DENY\r"
  8 => "Access-Control-Allow-Origin: https://sendgrid.api-docs.io\r"
  9 => "Access-Control-Allow-Methods: POST\r"
  10 => "Access-Control-Allow-Headers: Authorization, Content-Type, On-behalf-of, x-sg-elas-acl\r"
  11 => "Access-Control-Max-Age: 600\r"
  12 => "X-No-CORS-Reason: https://sendgrid.com/docs/Classroom/Basics/API/cors.html\r"
  13 => "\r"
  14 => ""
]

I think it could happen, that the needed "X-Message-Id" will not always be in [6], so please provide headers in a nicer way, e.g. associative array - carriage return character removed. Thanks!

"X-Message-Id" is the Sendgrid Message Id which I need for further processing of Webhooks.

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