redpanda-data / redpanda-data/connect

http_server sync_response should infer content-type by default

Open
#2,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

annoying inputs v5
Dominant language
Go
Stars
8.8k
Forks
969
Avg merge
1d 13h
Merged PRs (30d)
64

Description

Currently when you return a sync_response to the http_server input it has a Content-Type header field set by default: https://www.benthos.dev/docs/components/inputs/http_server#sync_responseheaders. However, we already have an underlying behaviour to automatically detect the content type by peeking at the data, which you can expose by manually setting the header to an empty string: headers: { "Content-Type": "" }.

This is awkward and weird behaviour, we should default to peeking and inferring unless the user has explicitly set a Content-Type header of their own.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the http_server input's sync_response handling and review the existing content-type detection behavior described in the issue. Verify that responses infer Content-Type when no header is supplied, while an explicitly provided Content-Type remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.