예제 #1
0
파일: client.go 프로젝트: robmurtha/mercury
func (c *client) unmarshaler(rsp mercury.Response, protocol interface{}) tmsg.Unmarshaler {
	result := marshaling.Unmarshaler(rsp.Headers()[marshaling.ContentTypeHeader], protocol)
	if result == nil { // Default to proto
		result = marshaling.Unmarshaler(marshaling.ProtoContentType, protocol)
	}
	return result
}
예제 #2
0
파일: message.go 프로젝트: mondough/mercury
func old2NewResponse(req typhon.Request, oldRsp mercury.Response) typhon.Response {
	rsp := typhon.NewResponse(req)
	rsp.Header = toHeader(oldRsp.Headers())
	rsp.Write(oldRsp.Payload())
	rsp.Error = oldRsp.Error()
	return rsp
}
예제 #3
0
func (m *testMw) ProcessClientResponse(rsp mercury.Response, req mercury.Request) mercury.Response {
	rsp.SetHeader("X-Boop", "Boop")
	return rsp
}
예제 #4
0
func (m *testMw) ProcessClientResponse(rsp mercury.Response, ctx context.Context) mercury.Response {
	rsp.SetHeader("X-Boop", "Boop")
	return rsp
}
예제 #5
0
func (m requestTreeMiddleware) ProcessServerResponse(rsp mercury.Response, ctx context.Context) mercury.Response {
	if v, ok := ctx.Value(parentIdCtxKey).(string); ok && v != "" && rsp != nil {
		rsp.SetHeader(parentIdHeader, v)
	}
	return rsp
}