示例#1
0
文件: diag.go 项目: zalando/skipper
func (t *throttle) Response(ctx filters.FilterContext) {
	switch t.typ {
	case backendLatency, backendBandwidth, backendChunks:
		return
	}

	rsp := ctx.Response()
	rsp.Body = t.goThrottle(rsp.Body, true)
}
示例#2
0
func (c *compress) Response(ctx filters.FilterContext) {
	rsp := ctx.Response()

	if !canEncodeEntity(rsp, c.mime) {
		return
	}

	enc := acceptedEncoding(ctx.Request())
	if enc == "" {
		return
	}

	responseHeader(rsp, enc)
	responseBody(rsp, enc, c.level)
}
示例#3
0
func (f *headerFilter) Response(ctx filters.FilterContext) {
	switch f.typ {
	case setResponseHeader:
		ctx.Response().Header.Set(f.key, f.value)
	case appendResponseHeader, depResponseHeader:
		ctx.Response().Header.Add(f.key, f.value)
	case dropResponseHeader:
		ctx.Response().Header.Del(f.key)
	}
}
示例#4
0
func (f *headerFilter) Response(ctx filters.FilterContext) {
	if f.typ == responseHeader {
		ctx.Response().Header.Add(f.key, f.value)
	}
}
示例#5
0
func (corf *preserveOriginalFilter) Response(ctx filters.FilterContext) {
	preserveHeader(ctx.OriginalResponse().Header, ctx.Response().Header)
}
示例#6
0
文件: status.go 项目: zalando/skipper
func (f statusFilter) Response(ctx filters.FilterContext) {
	ctx.Response().StatusCode = int(f)
}
示例#7
0
func (h *healthCheck) Response(ctx filters.FilterContext)                   { ctx.Response().StatusCode = http.StatusOK }