This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
frostfs-rest-gw/gen/restapi/operations/options_objects_put_responses.go
Denis Kirillov d18312ecde [#39] Add CORS
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-08-10 21:41:26 +03:00

102 lines
3.4 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
)
// OptionsObjectsPutOKCode is the HTTP code returned for type OptionsObjectsPutOK
const OptionsObjectsPutOKCode int = 200
/*OptionsObjectsPutOK CORS
swagger:response optionsObjectsPutOK
*/
type OptionsObjectsPutOK struct {
/*
*/
AccessControlAllowHeaders string `json:"Access-Control-Allow-Headers"`
/*
*/
AccessControlAllowMethods string `json:"Access-Control-Allow-Methods"`
/*
*/
AccessControlAllowOrigin string `json:"Access-Control-Allow-Origin"`
}
// NewOptionsObjectsPutOK creates OptionsObjectsPutOK with default headers values
func NewOptionsObjectsPutOK() *OptionsObjectsPutOK {
return &OptionsObjectsPutOK{}
}
// WithAccessControlAllowHeaders adds the accessControlAllowHeaders to the options objects put o k response
func (o *OptionsObjectsPutOK) WithAccessControlAllowHeaders(accessControlAllowHeaders string) *OptionsObjectsPutOK {
o.AccessControlAllowHeaders = accessControlAllowHeaders
return o
}
// SetAccessControlAllowHeaders sets the accessControlAllowHeaders to the options objects put o k response
func (o *OptionsObjectsPutOK) SetAccessControlAllowHeaders(accessControlAllowHeaders string) {
o.AccessControlAllowHeaders = accessControlAllowHeaders
}
// WithAccessControlAllowMethods adds the accessControlAllowMethods to the options objects put o k response
func (o *OptionsObjectsPutOK) WithAccessControlAllowMethods(accessControlAllowMethods string) *OptionsObjectsPutOK {
o.AccessControlAllowMethods = accessControlAllowMethods
return o
}
// SetAccessControlAllowMethods sets the accessControlAllowMethods to the options objects put o k response
func (o *OptionsObjectsPutOK) SetAccessControlAllowMethods(accessControlAllowMethods string) {
o.AccessControlAllowMethods = accessControlAllowMethods
}
// WithAccessControlAllowOrigin adds the accessControlAllowOrigin to the options objects put o k response
func (o *OptionsObjectsPutOK) WithAccessControlAllowOrigin(accessControlAllowOrigin string) *OptionsObjectsPutOK {
o.AccessControlAllowOrigin = accessControlAllowOrigin
return o
}
// SetAccessControlAllowOrigin sets the accessControlAllowOrigin to the options objects put o k response
func (o *OptionsObjectsPutOK) SetAccessControlAllowOrigin(accessControlAllowOrigin string) {
o.AccessControlAllowOrigin = accessControlAllowOrigin
}
// WriteResponse to the client
func (o *OptionsObjectsPutOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
// response header Access-Control-Allow-Headers
accessControlAllowHeaders := o.AccessControlAllowHeaders
if accessControlAllowHeaders != "" {
rw.Header().Set("Access-Control-Allow-Headers", accessControlAllowHeaders)
}
// response header Access-Control-Allow-Methods
accessControlAllowMethods := o.AccessControlAllowMethods
if accessControlAllowMethods != "" {
rw.Header().Set("Access-Control-Allow-Methods", accessControlAllowMethods)
}
// response header Access-Control-Allow-Origin
accessControlAllowOrigin := o.AccessControlAllowOrigin
if accessControlAllowOrigin != "" {
rw.Header().Set("Access-Control-Allow-Origin", accessControlAllowOrigin)
}
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(200)
}