Skip to content

Add ability to set error response headers #801

Closed

Description

@epompeii

I currently have response headers working for CORS, after looking at how Oxide does so in cio: https://github.com/bencherdev/bencher/blob/main/services/api/src/util/headers.rs
I think this may solve: #57

But there is no way to set error response headers.

The headers for a valid request look like this (happy CORS):

access-control-allow-headers | Content-Type
access-control-allow-methods | GET
access-control-allow-origin | *
content-length | 255
content-type | application/json
date | Sun, 15 Oct 2023 23:43:19 GMT
x-request-id | 46e28335-f418-4731-ae94-a73588908f63

But the headers for an error request look like this (unhappy CORS):

content-length | 133
content-type | application/json
date | Sun, 15 Oct 2023 23:43:33 GMT
x-request-id | 0c32030a-a999-4b42-9a0f-653696564e26

Internally, it looks like dropshot uses this HttpError into_response method: https://docs.rs/dropshot/latest/src/dropshot/error.rs.html#237
So it would be great to be able to add additional headers to HttpError or just have it also use the headers set for a valid request.

Activity

  1. davepacheco commented on Oct 18, 2023

    @davepacheco
    Collaborator

    Yeah. See also #57. We left out error responses when we did #283. Also related are #39, #41.

  2. davepacheco commented on Oct 3, 2024

    @davepacheco
    Collaborator

    I think the plan here should be what's proposed in #39.

  3. added a commit that references this issue on Dec 5, 2024
    14db823
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