Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Can't use my own model with content negotiation #89

Open
webaaz opened this issue Aug 26, 2015 · 2 comments
Open

Can't use my own model with content negotiation #89

webaaz opened this issue Aug 26, 2015 · 2 comments

Comments

@webaaz
Copy link

webaaz commented Aug 26, 2015

Hi!

I got an API with content negotiation. For binaries resources, the caller don't know the mime type.
Typically, if it's a element in an HTML page, I can't specify headers.

When the resource GET method is called, the server knows its type, and I can return an ImageModel or PdfModel or whatever I need instead of HalEntity or HalCollection, but the RestController encapsulate my model into a new entity and a ContentNegotiationViewModel... :-/

Rest controller should bypass contentNegotiation if I want to use my own model.

@webaaz webaaz changed the title Can't use my own model without content negotiation Can't use my own model with content negotiation Aug 26, 2015
@webaaz
Copy link
Author

webaaz commented Aug 26, 2015

I use a patch to bypass, setting headers in the resource

$this->getEvent()->getRequest()->getHeaders()->addHeaderLine('content-type', 'application/pdf');

I think it's not the best way...

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-rest; a new issue has been opened at laminas-api-tools/api-tools-rest#5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants