scramble icon indicating copy to clipboard operation
scramble copied to clipboard

Support for Adding Custom Headers to Responses

Open ojha007 opened this issue 10 months ago • 0 comments

I would like to know if Scramble supports adding custom headers to responses. If not, is this something planned for future updates?

Use Case

In some scenarios, modifying or adding headers (such as Content-Type, Cache-Control, or custom security headers) is necessary when returning a response. This can help with API security, CORS, or performance optimizations.

Expected Behavior

  1. Ability to configure headers via Response.
  2. Option to dynamically modify headers based on request conditions.

Example:

paths:
  /ping:
    get:
      summary: Checks if the server is alive.
      responses:
        "200":
          description: OK
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
              description: Request limit per hour.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            X-RateLimit-Reset:
              schema:
                type: string
                format: date-time
              description: The UTC date/time at which the current rate limit window resets.
         content:
            ........

If this feature is already available, could you provide documentation or an example of how to implement it?

ojha007 avatar Feb 14 '25 02:02 ojha007