mirror of
https://github.com/rancher/steve.git
synced 2025-05-01 20:53:46 +00:00
25 lines
545 B
Go
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")
|
||
|
}
|