Norwæ
Norwæ

Reputation: 1575

Content negotiation for spray in error handlers

I am trying to use content negotiation in a spray-based application. The following test describes my expected behaviour. Unfortunately, this is not what I see (Put to github for size):

https://gist.github.com/Norwae/49c26613f91c32482bb1

Essentially, content-negotiation seems to work fine when complete() is invoked from within the normal routing. It does not seem to function at all within an ExceptionHandler, where the first available serializer is selected regardless of Accept header.

Is there any way to achieve the same behaviour in the exception handler? Are there any alternatives other than using onComplete and handling errors explicitly all over the place?

Upvotes: 1

Views: 27

Answers (0)

Related Questions