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

@@ -2,7 +2,7 @@ swagger: '2.0'
info:
title: fn
description: The open source serverless platform.
version: "0.2.2"
version: "0.2.3"
# the domain of the service
host: "127.0.0.1:8080"
# array of all schemes that your API supports
@@ -371,6 +371,7 @@ paths:
tags:
- Call
- Log
produces: ['text/plain',]
parameters:
- name: app
description: App Name
@@ -386,7 +387,7 @@ paths:
200:
description: Log found
schema:
$ref: '#/definitions/LogWrapper'
type: string
404:
description: Log not found.
schema:
@@ -636,25 +637,6 @@ definitions:
$ref: '#/definitions/Call'
description: "Call object."
LogWrapper:
type: object
required:
- log
properties:
log:
$ref: '#/definitions/Log'
description: "Call log entry."
Log:
type: object
properties:
call_id:
type: string
description: Call UUID ID
log:
type: string # maybe bytes, long logs wouldn't fit into string type
Call:
type: object
properties: