update thrift, opencensus, others (#893)

* update thrift, opencensus, others

* stats: update to opencensus 0.6.0 view api
This commit is contained in:
Reed Allman
2018-03-26 15:43:49 -07:00
committed by GitHub
parent 0ce5c4500b
commit 8af605cf3d
1266 changed files with 122191 additions and 28775 deletions

View File

@@ -17,7 +17,7 @@ import (
"github.com/fnproject/fdk-go/utils"
)
func echoHTTPHandler(ctx context.Context, in io.Reader, out io.Writer) {
func echoHTTPHandler(_ context.Context, in io.Reader, out io.Writer) {
io.Copy(out, in)
WriteStatus(out, http.StatusTeapot+2)
SetHeader(out, "yo", "dawg")
@@ -67,19 +67,18 @@ func JSONHandler(_ context.Context, in io.Reader, out io.Writer) {
}
}
func JSONWithStatusCode(_ context.Context, in io.Reader, out io.Writer) {
func JSONWithStatusCode(_ context.Context, _ io.Reader, out io.Writer) {
SetHeader(out, "Content-Type", "application/json")
WriteStatus(out, 201)
}
func TestJSON(t *testing.T) {
req := &utils.JsonIn{
`{"name":"john"}`,
"application/json",
"someid",
"2018-01-30T16:52:39.786Z",
"sync",
utils.CallRequestHTTP{
CallID: "someid",
Body: `{"name":"john"}`,
ContentType: "application/json",
Deadline: "2018-01-30T16:52:39.786Z",
Protocol: utils.CallRequestHTTP{
Type: "http",
RequestURL: "someURL",
Headers: http.Header{},
@@ -146,12 +145,11 @@ func TestJSONEOF(t *testing.T) {
func TestJSONOverwriteStatusCodeAndHeaders(t *testing.T) {
var out, buf bytes.Buffer
req := &utils.JsonIn{
`{"name":"john"}`,
"application/json",
"someid",
"2018-01-30T16:52:39.786Z",
"sync",
utils.CallRequestHTTP{
CallID: "someid",
Body: `{"name":"john"}`,
ContentType: "application/json",
Deadline: "2018-01-30T16:52:39.786Z",
Protocol: utils.CallRequestHTTP{
Type: "json",
RequestURL: "someURL",
Headers: http.Header{},

View File

@@ -101,11 +101,10 @@ type CallRequestHTTP struct {
}
type JsonIn struct {
Body string `json:"body"`
ContentType string `json:"content_type"`
CallID string `json:"call_id"`
Deadline string `json:"deadline"`
Type string `json:"type"`
Body string `json:"body"`
ContentType string `json:"content_type"`
Protocol CallRequestHTTP `json:"protocol"`
}