github.com/aacfactory/fns@v1.2.86-0.20240310083819-80d667fc0a17/transports/middlewares/cors/vars.go (about)

     1  /*
     2   * Copyright 2023 Wang Min Xiang
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   * 	http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   *
    16   */
    17  
    18  package cors
    19  
    20  import (
    21  	"github.com/aacfactory/fns/commons/bytex"
    22  	"github.com/aacfactory/fns/transports"
    23  	"net/http"
    24  )
    25  
    26  var (
    27  	varyHeader                               = transports.VaryHeaderName
    28  	accessControlRequestMethodHeader         = transports.AccessControlRequestMethodHeaderName
    29  	originHeader                             = transports.OriginHeaderName
    30  	accessControlRequestHeadersHeader        = transports.AccessControlRequestHeadersHeaderName
    31  	accessControlRequestPrivateNetworkHeader = transports.AccessControlRequestPrivateNetworkHeaderName
    32  	accessControlAllowOriginHeader           = transports.AccessControlAllowOriginHeaderName
    33  	accessControlAllowMethodsHeader          = transports.AccessControlAllowMethodsHeaderName
    34  	accessControlAllowHeadersHeader          = transports.AccessControlAllowHeadersHeaderName
    35  	accessControlAllowCredentialsHeader      = transports.AccessControlAllowCredentialsHeaderName
    36  	accessControlAllowPrivateNetworkHeader   = transports.AccessControlAllowPrivateNetworkHeaderName
    37  	accessControlMaxAgeHeader                = transports.AccessControlMaxAgeHeaderName
    38  	accessControlExposeHeadersHeader         = transports.AccessControlExposeHeadersHeaderName
    39  )
    40  
    41  var (
    42  	methodOptions = bytex.FromString(http.MethodOptions)
    43  	methodHead    = bytex.FromString(http.MethodHead)
    44  	methodGet     = bytex.FromString(http.MethodGet)
    45  	methodPost    = bytex.FromString(http.MethodPost)
    46  )
    47  
    48  var (
    49  	all       = []byte{'*'}
    50  	trueBytes = []byte{'t', 'r', 'u', 'e'}
    51  	joinBytes = []byte{',', ' '}
    52  )