mirror of
https://github.com/niusmallnan/steve.git
synced 2025-09-11 09:59:39 +00:00
Refactor
This commit is contained in:
24
pkg/schemaserver/writer/headers.go
Normal file
24
pkg/schemaserver/writer/headers.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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")
|
||||
}
|
Reference in New Issue
Block a user