Trigger content negotiation failures before response generation
- Dominant language
- Scala
- Stars
- 1.4k
- Forks
- 584
- Avg merge
- 14h 33m
- Merged PRs (30d)
- 24
Description
**Issue by [sirthias](https://github.com/sirthias)**
_Monday Mar 02, 2015 at 10:22 GMT_
_Originally opened as https://github.com/akka/akka/issues/16974_
---
Currently the marshalling infrastructure only gets invoked once the actual response has been produced. This means that content negotiation failures are triggered late, after the backend has already processed the response. For safe methods (e.g. GET) this only results in the wasted work for retrieving the resource (which might already be significant), but for unsafe methods this could actually result in a state change that doesn't get signaled properly to the client.
Currently a marshaller is defined as
``` scala
sealed abstract class Marshaller[-A, +B] extends (A ⇒ Future[List[Marshalling[B]]])
```
which means that switching to a "fail early" model does require modification to the very core of the marshaling infrastructure. However, I currently don't see why it shouldn't be possible.
Contributor guide
Research direction
Start with the Marshaller definition shown in the issue and trace where the marshalling infrastructure is invoked relative to response generation. Determine how content negotiation failures are currently surfaced and what core infrastructure changes are required. Done means failures are triggered before backend response processing, including for unsafe methods.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100