haxetink / tink_web

Tinkerbell Web Framework
https://haxetink.github.io/tink_web
43 stars 14 forks source link

The content-type for `Source`s is hardcoded. #92

Closed ousado closed 4 years ago

ousado commented 5 years ago

The content-type for RealSource and IdealSource is hardcoded.

@:produces is being ignored.

https://github.com/haxetink/tink_web/blob/5c82edd65039f5a071d700e026b76777d164a091/src/tink/web/routing/Response.hx#L19

back2dos commented 5 years ago

If you need full control, then you can always form a full OutgoingResponse.

The point of @:consumes/@:produces is tell tink_web how to represent payload over the wire. But indeed, it could also signal the content-type for raw bodies.

ousado commented 5 years ago

I see, thanks. It would make sense to be able to set the content-type easily and directly, though, wouldn't it? Something like @:contentType(...) perhaps?

back2dos commented 5 years ago

Yup. Kevin had also suggested @:header(name, value) a while ago. Something of the sort is probably useful ;)

kevinresol commented 5 years ago

@:header is implemented but I am not sure if it works in this case. Because the content-type header is already added. Perhaps content-type needs special treatment.