Skip to content

Support custom Content-Type header#28

Open
hatamiarash7 wants to merge 2 commits intohashicorp:mainfrom
hatamiarash7:main
Open

Support custom Content-Type header#28
hatamiarash7 wants to merge 2 commits intohashicorp:mainfrom
hatamiarash7:main

Conversation

@hatamiarash7
Copy link

This pull request enhances the configuration and usability of the http-echo Go web server. The main improvements include support for setting the HTTP response Content-Type header via a command-line flag, updates to the README for clearer documentation, and adjustments to handler functions to accommodate the new configuration option.

Documentation improvements:

  • Expanded the README.md to include a configuration table detailing all command-line arguments, their defaults, and descriptions, making it easier for users to understand available options.

Feature additions:

  • Added the -content-type command-line flag in main.go, allowing users to customize the Content-Type header of HTTP responses. The returned content-type header for all responses is text/plain; charset=utf-8 right now.
  • Updated the withAppHeaders function in handlers.go to accept and set the Content-Type header in responses, supporting the new flag.

Integration and usage:

  • Modified the main handler registrations in main.go to pass the Content-Type value from the flag to all endpoints, ensuring consistent header behavior.

@hashicorp-cla-app
Copy link

hashicorp-cla-app bot commented Mar 7, 2026

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

1 participant