1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-27 02:51:10 +00:00
steve/pkg/schemaserver/writer/headers.go
Darren Shepherd 8b42d0aff8 Refactor
2020-01-30 22:37:59 -07:00

25 lines
545 B
Go

package writer
import (
"github.com/rancher/steve/pkg/schemaserver/types"
)
func AddCommonResponseHeader(apiOp *types.APIRequest) error {
addExpires(apiOp)
return addSchemasHeader(apiOp)
}
func addSchemasHeader(apiOp *types.APIRequest) error {
schema := apiOp.Schemas.Schemas["schema"]
if schema == nil {
return nil
}
apiOp.Response.Header().Set("X-Api-Schemas", apiOp.URLBuilder.Collection(schema))
return nil
}
func addExpires(apiOp *types.APIRequest) {
apiOp.Response.Header().Set("Expires", "Wed 24 Feb 1982 18:42:00 GMT")
}