rest - Returning a video from a POST request -


i have build simple server myself using go , running odd issue.

i've created route "/transcoding" users can issue post http request multipart video file , receive modified video.

the problem i'm having when returning video in response, doesn't seem automatically play in chrome/safari/firefox.

i know video being returned valid though because if use curl/httpie or save set content-type attachment, resulting file plays fine.

is perhaps post-get-redirect ?

http -f post http://localhost:8080/transcode input@~/downloads/sample.mp4    http/1.1 200 ok accept-ranges: bytes content-disposition: attachment; filename=output.mp4 content-length: 398037 content-type: video/mp4 date: sun, 24 jan 2016 22:00:00 gmt last-modified: sun, 24 jan 2016 22:00:00 gmt    +-----------------------------------------+ | note: binary data not shown in terminal | +-----------------------------------------+ 

the above sample shows i've set content-length , content-type appropriately. browser show video player nothing plays. (if drag-n-drop saved file though, play)

"content-disposition: attachment" not appropriate in case. the mdn has description:

in regular http response, content-disposition response header header indicating if content expected displayed inline in browser, is, web page or part of web page, or attachment, downloaded , saved locally.

if want browser play video, either remove header or change value "inline".


Comments