Ship call logs to the user as text/plain instead of JSON (#615)

* Ship call logs to the user as text/plain instead of JSON

* Fixing swagger doc

* c.String instead of c.JSON

* Make Logs API backward compatible

* Loop over accepted MIME types

* Bump swagger API version

* Fix client build script

 previous version was producing the following "couldn't find a swagger spec"

* Logs API regression test

* Write response body without buffering

* Switch JSON and text/plain cases

* Handle Accepted content types properly

* More solid response content type handling

* Write HTTP 406 with corresponding error body

* Remove unused import

* Use handleErrorResponse
This commit is contained in:
Denis Makogon
2018-01-03 00:01:22 +02:00
committed by Reed Allman
parent 9e9cb136ed
commit 60d2ca234f
4 changed files with 47 additions and 38 deletions

View File

@@ -87,7 +87,7 @@ languages.each do |l|
destdir = "tmp/fn_#{lshort}"
if l == 'go'
# This is using https://goswagger.io/ instead
stream_exec "docker run --rm -v ${PWD}/#{clone_dir}:/go/src/github.com/fnproject/fn_go -w /go/src/github.com/fnproject/fn_go quay.io/goswagger/swagger generate client -f #{swaggerUrl} -A fn "
stream_exec "docker run --rm -v ${PWD}/#{clone_dir}:/go/src/github.com/fnproject/fn_go -v ${GOPATH}/src/github.com/fnproject/fn/docs/swagger.yml:/go/src/github.com/fnproject/fn/swagger.yml -w /go/src/github.com/fnproject/fn_go quay.io/goswagger/swagger generate client -f /go/src/github.com/fnproject/fn/swagger.yml -A fn "
else
gen = JSON.parse(HTTP.post("https://generator.swagger.io/api/gen/clients/#{l}",
json: {