1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 15:18:20 +00:00

More initial dev

This commit is contained in:
Darren Shepherd
2017-11-10 21:44:02 -07:00
parent c06696a1e4
commit c8cab3f4f8
72 changed files with 5674 additions and 1211 deletions

25
api/headers.go Normal file
View File

@@ -0,0 +1,25 @@
package api
import (
"github.com/rancher/norman/api/builtin"
"github.com/rancher/norman/types"
)
func addCommonResponseHeader(apiContext *types.APIContext) error {
addExpires(apiContext)
return addSchemasHeader(apiContext)
}
func addSchemasHeader(apiContext *types.APIContext) error {
schema := apiContext.Schemas.Schema(&builtin.Version, "schema")
if schema == nil {
return nil
}
apiContext.Response.Header().Set("X-Api-Schemas", apiContext.URLBuilder.Collection(schema))
return nil
}
func addExpires(apiContext *types.APIContext) {
apiContext.Response.Header().Set("Expires", "Wed 24 Feb 1982 18:42:00 GMT")
}