haskell-servant / haskell-servant/servant

How to model return types that depend on a Header value

Open
#1,168 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
2k
Forks
427
Avg merge
2d 23h
Merged PRs (30d)
5

Description

I am primarily concerned with defining Apis for third party services, where an answer like "don't do that" does not apply.

My specific situation is where an endpoint returns fairly large type `Foo` with no special headers, but with a `X-Requested-With: XMLHttpRequest` header the return type is shrunk to just the `Bar` type.

It seems as though `Capture` has `Symbol` as it's static equivalent, so `Header` should ideally also have a static equivalent.

Contributor guide

Open the contributing guide

Research direction

Start by examining how Capture provides Symbol as its static equivalent, then compare that design with Header in servant. Done means determining and documenting an appropriate static equivalent for Header that can model return types dependent on the X-Requested-With value.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.