Skip to content

struct HttpMethods

cangjie
public struct HttpMethods

功能:提供 HTTP 请求方法常量和比较工具。

成员概览

成员功能
const Connect表示 HTTP CONNECT 方法。
const Delete表示 HTTP DELETE 方法。
const Get表示 HTTP GET 方法。
const Head表示 HTTP HEAD 方法。
const Options表示 HTTP OPTIONS 方法。
const Patch表示 HTTP PATCH 方法。
const Post表示 HTTP POST 方法。
const Put表示 HTTP PUT 方法。
const Query表示 HTTP QUERY 方法。
const Trace表示 HTTP TRACE 方法。
func isConnect(String)检查请求方法是否为 CONNECT。
func isDelete(String)检查请求方法是否为 DELETE。
func isGet(String)检查请求方法是否为 GET。
func isHead(String)检查请求方法是否为 HEAD。
func isOptions(String)检查请求方法是否为 OPTIONS。
func isPatch(String)检查请求方法是否为 PATCH。
func isPost(String)检查请求方法是否为 POST。
func isPut(String)检查请求方法是否为 PUT。
func isQuery(String)检查请求方法是否为 QUERY。
func isTrace(String)检查请求方法是否为 TRACE。
func getCanonicalizedValue(String)返回请求方法的规范化字符串实例。
func equals(String, String)比较两个请求方法是否相等。

const Connect

cangjie
public static const Connect = "CONNECT"

功能:表示 HTTP CONNECT 方法。

const Delete

cangjie
public static const Delete = "DELETE"

功能:表示 HTTP DELETE 方法。

const Get

cangjie
public static const Get = "GET"

功能:表示 HTTP GET 方法。

const Head

cangjie
public static const Head = "HEAD"

功能:表示 HTTP HEAD 方法。

const Options

cangjie
public static const Options = "OPTIONS"

功能:表示 HTTP OPTIONS 方法。

const Patch

cangjie
public static const Patch = "PATCH"

功能:表示 HTTP PATCH 方法。

const Post

cangjie
public static const Post = "POST"

功能:表示 HTTP POST 方法。

const Put

cangjie
public static const Put = "PUT"

功能:表示 HTTP PUT 方法。

const Query

cangjie
public static const Query = "QUERY"

功能:表示 HTTP QUERY 方法。

const Trace

cangjie
public static const Trace = "TRACE"

功能:表示 HTTP TRACE 方法。

func isConnect(String)

cangjie
public static func isConnect(method: String): Bool

功能:检查请求方法是否为 CONNECT。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 CONNECT 则返回 true,否则返回 false。

func isDelete(String)

cangjie
public static func isDelete(method: String): Bool

功能:检查请求方法是否为 DELETE。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 DELETE 则返回 true,否则返回 false。

func isGet(String)

cangjie
public static func isGet(method: String): Bool

功能:检查请求方法是否为 GET。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 GET 则返回 true,否则返回 false。

func isHead(String)

cangjie
public static func isHead(method: String): Bool

功能:检查请求方法是否为 HEAD。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 HEAD 则返回 true,否则返回 false。

func isOptions(String)

cangjie
public static func isOptions(method: String): Bool

功能:检查请求方法是否为 OPTIONS。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 OPTIONS 则返回 true,否则返回 false。

func isPatch(String)

cangjie
public static func isPatch(method: String): Bool

功能:检查请求方法是否为 PATCH。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 PATCH 则返回 true,否则返回 false。

func isPost(String)

cangjie
public static func isPost(method: String): Bool

功能:检查请求方法是否为 POST。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 POST 则返回 true,否则返回 false。

func isPut(String)

cangjie
public static func isPut(method: String): Bool

功能:检查请求方法是否为 PUT。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 PUT 则返回 true,否则返回 false。

func isQuery(String)

cangjie
public static func isQuery(method: String): Bool

功能:检查请求方法是否为 QUERY。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 QUERY 则返回 true,否则返回 false。

func isTrace(String)

cangjie
public static func isTrace(method: String): Bool

功能:检查请求方法是否为 TRACE。

参数:

  • method: String - 要检查的请求方法。

返回值:

  • Bool - 如果请求方法为 TRACE 则返回 true,否则返回 false。

func getCanonicalizedValue(String)

cangjie
public static func getCanonicalizedValue(method: String): String

功能:返回请求方法的规范化字符串实例。

参数:

  • method: String - 原始请求方法。

返回值:

  • String - 与已知方法匹配的共享字符串;如果未匹配则返回原始字符串。

func equals(String, String)

cangjie
public static func equals(methodA: String, methodB: String): Bool

功能:比较两个请求方法是否相等。

参数:

  • methodA: String - 第一个请求方法。
  • methodB: String - 第二个请求方法。

返回值:

  • Bool - 如果两个请求方法相等则返回 true,否则返回 false。