add raw handler support
This commit is contained in:
@@ -530,7 +530,10 @@ func (chain *ProxyChain) Execute() error {
|
||||
}
|
||||
|
||||
// in case api user did not set or forward content-type, we do it for them
|
||||
if chain.Context.Get("content-type") == "" {
|
||||
// warning: the fiber method chain.Context.Get() doesn't seem to work as described
|
||||
ct := chain.Context.Response().Header.Peek("content-type")
|
||||
CT := chain.Context.Response().Header.Peek("Content-Type")
|
||||
if ct == nil && CT == nil {
|
||||
chain.Context.Set("content-type", chain.Response.Header.Get("content-type"))
|
||||
}
|
||||
|
||||
|
||||
@@ -6,16 +6,16 @@ import (
|
||||
|
||||
// SetResponseHeader modifies response headers from the upstream server
|
||||
func SetResponseHeader(key string, value string) proxychain.ResponseModification {
|
||||
return func(px *proxychain.ProxyChain) error {
|
||||
px.Context.Response().Header.Set(key, value)
|
||||
return func(chain *proxychain.ProxyChain) error {
|
||||
chain.Context.Set(key, value)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteResponseHeader removes response headers from the upstream server
|
||||
func DeleteResponseHeader(key string) proxychain.ResponseModification {
|
||||
return func(px *proxychain.ProxyChain) error {
|
||||
px.Context.Response().Header.Del(key)
|
||||
return func(chain *proxychain.ProxyChain) error {
|
||||
chain.Context.Response().Header.Del(key)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user