{"id":15364825,"url":"https://github.com/hexilee/htest","last_synced_at":"2025-04-15T07:31:22.874Z","repository":{"id":57518567,"uuid":"122324855","full_name":"Hexilee/htest","owner":"Hexilee","description":"htest is a http-test package","archived":false,"fork":false,"pushed_at":"2018-09-30T12:20:13.000Z","size":54,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T18:50:33.139Z","etag":null,"topics":["go","golang","http","http-client","httptest","mock","test","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hexilee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-21T10:57:30.000Z","updated_at":"2024-10-15T08:18:38.000Z","dependencies_parsed_at":"2022-09-26T18:01:44.784Z","dependency_job_id":null,"html_url":"https://github.com/Hexilee/htest","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hexilee%2Fhtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hexilee%2Fhtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hexilee%2Fhtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hexilee%2Fhtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hexilee","download_url":"https://codeload.github.com/Hexilee/htest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249026792,"owners_count":21200507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","http","http-client","httptest","mock","test","testing"],"created_at":"2024-10-01T13:13:21.862Z","updated_at":"2025-04-15T07:31:22.511Z","avatar_url":"https://github.com/Hexilee.png","language":"Go","readme":"## htest is a http-test package\n\n[![Coverage Status](https://coveralls.io/repos/github/Hexilee/htest/badge.svg)](https://coveralls.io/github/Hexilee/htest)\n[![Go Report Card](https://goreportcard.com/badge/github.com/Hexilee/htest)](https://goreportcard.com/report/github.com/Hexilee/htest)\n[![Build Status](https://travis-ci.org/Hexilee/htest.svg?branch=master)](https://travis-ci.org/Hexilee/htest)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Hexilee/htest/blob/master/LICENSE)\n[![Documentation](https://godoc.org/github.com/Hexilee/htest?status.svg)](https://godoc.org/github.com/Hexilee/htest)\n\n\nTable of Contents\n=================\n\n* [Basic Usage](#basic-usage)\n  * [Test MockServer](#test-mockserver)\n     * [Test HandlerFunc](#test-handlerfunc)\n     * [To ServeMux](#to-servemux)\n     * [To Echo](#to-echo)\n  * [Test RealServer](#test-realserver)\n     * [Github API](#github-api)\n* [Client](#client)\n  * [Set MockServer](#set-mockserver)\n     * [HandlerFunc](#handlerfunc)\n     * [Handler](#handler)\n  * [Construct Request](#construct-request)\n     * [Http Methods](#http-methods)\n* [Request](#request)\n  * [Set Headers](#set-headers)\n  * [Add Cookie](#add-cookie)\n  * [Test](#test)\n  * [Send](#send)\n  * [As http.Request](#as-httprequest)\n* [Response](#response)\n  * [Assert StatusCode](#assert-statuscode)\n     * [Code](#code)\n     * [StatusXXX](#statusxxx)\n  * [Assert Headers](#assert-headers)\n     * [Headers](#headers)\n     * [HeaderXXX](#headerxxx)\n  * [Assert Body](#assert-body)\n  * [Get Body](#get-body)\n  * [Bind Body](#bind-body)\n  * [Body Types](#body-types)\n  * [As http.Response](#as-httpresponse)\n* [Body](#body)\n  * [JSON](#json)\n     * [Assert JSON Key](#assert-json-key)\n     * [Assert JSON Empty or Not](#assert-json-empty-or-not)\n     * [Bind JSON](#bind-json)\n  * [XML](#xml)\n  * [MD5](#md5)\n     * [Assert MD5 Hash](#assert-md5-hash)\n     * [Get MD5 Hash value](#get-md5-hash-value)\n  * [SHA1](#sha1)\n* [Appendix](#appendix)\n  * [consts](#consts)\n\n\n### Basic Usage\n\n-----------------\n\n#### Test MockServer\n\n\u003e Test a Handler or a HandlerFunc\n\n##### Test HandlerFunc\n\n```go\n// example/basic_mock_client.go\npackage myapp\n\nimport (\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc NameHandler(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, `{\"name\": \"hexi\"}`)\n}\n```\n\n```go\n// example/basic_mock_client_test.go\npackage myapp\n\nimport (\n\t\"testing\"\n\t\"github.com/Hexilee/htest\"\n)\n\nfunc TestNameHandlerFunc(t *testing.T) {\n\thtest.NewClient(t).\n\t\tToFunc(NameHandler).\n\t\tGet(\"\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"name\", \"hexi\")\n}\n```\n\nYou can also test handler (*http.ServeMux, *echo.Echo .etc.)\n\n##### To ServeMux\n\n```go\n// example/basic_mock_client.go\npackage myapp\n\nimport (\n\t\"io\"\n\t\"net/http\"\n)\n\nvar (\n\tMux *http.ServeMux\n)\n\nfunc init() {\n\tMux = http.NewServeMux()\n\tMux.HandleFunc(\"/name\", NameHandler)\n}\n\nfunc NameHandler(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, `{\"name\": \"hexi\"}`)\n}\n```\n\n```go\n// example/basic_mock_client_test.go\npackage myapp\n\nimport (\n\t\"testing\"\n\t\"github.com/Hexilee/htest\"\n)\n\nfunc TestNameHandler(t *testing.T) {\n\thtest.NewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/name\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"name\", \"hexi\")\n}\n```\n\n##### To Echo\n\n```go\n// example/basic_mock_client.go\npackage myapp\n\nimport (\n\t\"io\"\n\t\"github.com/labstack/echo\"\n)\n\nvar (\n\tserver *echo.Echo\n)\n\nfunc init() {\n\tserver = echo.New()\n\tserver.GET(\"/name\", NameHandlerEcho)\n}\n\nfunc NameHandlerEcho(c echo.Context) error {\n\treturn c.String(http.StatusOK, `{\"name\": \"hexi\"}`)\n}\n```\n\n```go\n// example/basic_mock_client_test.go\npackage myapp\n\nimport (\n\t\"testing\"\n\t\"github.com/Hexilee/htest\"\n)\n\nfunc TestNameHandlerEcho(t *testing.T) {\n\thtest.NewClient(t).\n\t\tTo(server).\n\t\tGet(\"/name\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"name\", \"hexi\")\n}\n```\n\n#### Test RealServer\n\n\u003e Send a http request and test the response\n\n##### Github API\n\n```go\n// request_test.go\nfunc TestRequest_Send(t *testing.T) {\n\tNewClient(t).\n\t\tGet(\"https://api.github.com/users/Hexilee\").\n\t\tSend().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"login\", \"Hexilee\")\n}\n```\n\n\n### Client\n\n-------\n\n#### Set MockServer\n\n\u003e Set mock server to be tested (Do not need it when you test real server)\n\n##### HandlerFunc\n\n\u003e Set a HandlerFunc as mock server\n\n```go\n// example/basic_mock_client_test.go\npackage myapp\n\nimport (\n\t\"testing\"\n\t\"github.com/Hexilee/htest\"\n)\n\nfunc TestNameHandlerFunc(t *testing.T) {\n\thtest.NewClient(t).\n\t\tToFunc(NameHandler).\n\t\tGet(\"\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"name\", \"hexi\")\n}\n```\n\n##### Handler\n\n\u003e Set a Handler as mock server\n\n```go\n// example/basic_mock_client_test.go\npackage myapp\n\nimport (\n\t\"testing\"\n\t\"github.com/Hexilee/htest\"\n)\n\nfunc TestNameHandler(t *testing.T) {\n\thtest.NewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/name\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"name\", \"hexi\")\n}\n```\n\n#### Construct Request\n\n\u003e Construct htest.Request using different http methods\n\n##### Http Methods\n\n\u003e For example\n\n- Get\n\n```go\n// client.go\nfunc (c Client) Get(path string) *Request\n```\n\n\u003e More\n\n- Head\n- Trace\n- Options\n- Connect\n- Delete\n- Post\n- Put\n- Patch\n\n### Request\n\n-------\n\n#### Set Headers\n\n\u003e Set headers and return *Request for chaining-call\n\n- SetHeader\n\n```go\n// server_test.go\n\nMux.Get(\"/request/header\", HeaderHandler)\n\n// request_test.go\n\nfunc HeaderHandler(w http.ResponseWriter, req *http.Request) {\n\tif req.Header.Get(HeaderContentType) == MIMEApplicationJSON {\n\t\tio.WriteString(w, `{\"result\": \"JSON\"}`)\n\t\treturn\n\t}\n\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n}\n\nfunc TestRequest_SetHeader(t *testing.T) {\n\tclient := NewClient(t).To(Mux)\n\t// bad content type\n\tclient.\n\t\tGet(\"/request/header\").\n\t\tSetHeader(HeaderContentType, MIMEApplicationForm).\n\t\tTest().\n\t\tStatusBadRequest()\n\n\t// right\n\tclient.\n\t\tGet(\"/request/header\").\n\t\tSetHeader(HeaderContentType, MIMEApplicationJSON).\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"result\", \"JSON\")\n}\n```\n\n\u003e HeaderContentType, MIMEApplicationForm are constants in const.go\n\u003e For more information, you can refer to [Appendix](#appendix)\n \n\n- SetHeaders\n\n```go\n// request_test.go\n\nfunc TestRequest_SetHeaders(t *testing.T) {\n\tclient := NewClient(t).To(Mux)\n\t// bad content type\n\tclient.Get(\"/request/header\").\n\t\tSetHeaders(\n\t\t\tmap[string]string{\n\t\t\t\tHeaderContentType: MIMEApplicationForm,\n\t\t\t},\n\t\t).\n\t\tTest().\n\t\tStatusBadRequest()\n\n\t// right\n\tclient.Get(\"/request/header\").\n\t\tSetHeaders(\n\t\t\tmap[string]string{\n\t\t\t\tHeaderContentType: MIMEApplicationJSON,\n\t\t\t},\n\t\t).\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"result\", \"JSON\")\n}\n```\n\n#### Add Cookie\n\n\u003e Add cookie and return *Request for chaining-call\n\n```go\n// server_test.go\n\nMux.Get(\"/request/cookie\", CookieHandler)\n\n// request_test.go\n\nvar (\n\ttestCookie = http.Cookie{Name: \"test_cookie\", Value: \"cookie_value\"}\n)\n\nfunc CookieHandler(w http.ResponseWriter, req *http.Request) {\n\tcookie, err := req.Cookie(testCookie.Name)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\tio.WriteString(w, fmt.Sprintf(`{\"cookie\": \"%s\"}`, cookie))\n}\n\n\nfunc TestRequest_AddCookie(t *testing.T) {\n\tclient := NewClient(t).\n\t\tTo(Mux)\n\tclient.\n\t\tGet(\"/request/cookie\").\n\t\tTest().\n\t\tStatusForbidden()\n\tclient.\n\t\tGet(\"/request/cookie\").\n\t\tAddCookie(\u0026testCookie).\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"cookie\", testCookie.String())\n}\n```\n\n#### Test\n\n\u003e Calling *Request.Test will test the mock server and return a *Response. \n\n\u003e You must have called Client.To or Client.ToFunc, otherwise causing a panic (htest.MockNilError)\n\n```go\n// request_test.go\n\nfunc TestRequest_Test(t *testing.T) {\n\tdefer func() {\n\t\tassert.Equal(t, MockNilError, recover())\n\t}()\n\n\tNewClient(t).\n\t\tGet(\"/request/header\").\n\t\tSetHeader(HeaderContentType, MIMEApplicationForm).\n\t\tTest().\n\t\tStatusBadRequest()\n}\n```\n\n#### Send\n\n\u003e Calling *Request.Send will send a real http request and return a *Response\n\n```go\n// request_test.go\n\nfunc TestRequest_Send(t *testing.T) {\n\tNewClient(t).\n\t\tGet(\"https://api.github.com/users/Hexilee\").\n\t\tSend().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"login\", \"Hexilee\")\n}\n\n```\n\n#### As http.Request\n\n\u003e As *http.Request is embedded in htest.Request, you can regard *htest.Request as *http.Request. Just like: \n\n```go\nuserAgent := NewClient(t).\n\t\tGet(\"https://api.github.com/users/Hexilee\").\n\t\tUserAgent()\n    \n```\n\n\n### Response\n\n-------\n\n#### Assert StatusCode\n\nAssert Response.StatusCode\n\n##### Code\n\n\u003e *Response.Code(statusCode int)\n\n```go\n// response_test.go\n\nvar (\n\tResponseCodeServer    = chi.NewRouter()\n)\n\nfunc init() {\n\tResponseCodeServer.Get(\"/response/statusCode/{code}\", StatusHandler)\n}\n\nfunc StatusHandler(w http.ResponseWriter, req *http.Request) {\n\tcodeStr := chi.URLParam(req, \"code\")\n\tcode, err := strconv.Atoi(codeStr)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.WriteHeader(code)\n}\t\n\nfunc TestResponse_Code(t *testing.T) {\n\tNewClient(t).\n\t\tTo(ResponseCodeServer).\n\t\tGet(fmt.Sprintf(\"/response/statusCode/%d\", http.StatusBadRequest)).\n\t\tTest().\n\t\tCode(http.StatusBadRequest)\n}\n```\n\n\n##### StatusXXX\n\n\u003e For more ergonomic development, *htest.Response has many methods to assert all the StatusCode in net/http\n\n```go\n// response_test.go\n\nfunc TestResponse_StatusContinue(t *testing.T) {\n\tNewClient(t).\n\t\tTo(ResponseCodeServer).\n\t\tGet(fmt.Sprintf(\"/response/statusCode/%d\", http.StatusContinue)).\n\t\tTest().\n\t\tStatusContinue()\n}\n\n```\n\n#### Assert Headers\n\nAssert Response.Headlers\n\n##### Headers\n\n\u003e *Response.Headers(key, expect string)\n\n```go\n// response_test.go\n\nvar (\n\tResponseHeadersServer = chi.NewRouter()\n)\n\nfunc init() {\n\tResponseHeadersServer.Get(\"/response/headers\", HeadersHandler)\n}\n\nfunc HeadersHandler(w http.ResponseWriter, req *http.Request) {\n\tquery := req.URL.Query()\n\theader := query.Get(\"header\")\n\tvalue := query.Get(\"value\")\n\tw.Header().Set(header, value)\n}\n\nfunc TestResponse_Headers(t *testing.T) {\n\turl := fmt.Sprintf(\"/response/headers?header=%s\u0026value=%s\", HeaderContentType, MIMEApplicationJSON)\n\tNewClient(t).\n\t\tTo(ResponseHeadersServer).\n\t\tGet(url).\n\t\tTest().\n\t\tHeaders(HeaderContentType, MIMEApplicationJSON)\n}\n```\n\n##### HeaderXXX\n\n\u003e For more ergonomic development, *htest.Response has many methods to assert all the Headers in const.go\n\n\n```go\n// response_test.go\n\nfunc TestResponse_HeaderAccept(t *testing.T) {\n\turl := fmt.Sprintf(\"/response/headers?header=%s\u0026value=%s\", HeaderAccept, \"htest\")\n\tNewClient(t).\n\t\tTo(ResponseHeadersServer).\n\t\tGet(url).\n\t\tTest().\n\t\tHeaderAccept(\"htest\")\n}\n```\n\n#### Assert Body\n\nYou can assert data in body straightly.\n\n```go\n// server_test.go\nMux.Get(\"/body/user\", UserDataHandler)\n\nfunc UserDataHandler(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, UserData)\n}\n\n// response_test.go\n\nconst (\n\tUserData = `{\n\t\"id\": 1,\n\t\"name\": \"hexi\"\n}`\n)\n\n\n\nfunc TestResponse_Expect(t *testing.T) {\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tExpect(UserData)\n}\n```\n\n\n#### Get Body\n\nYou can get data in body straightly\n\n- String\n\n```go\n// response_test.go\n\nfunc TestResponse_String(t *testing.T) {\n\tassert.Equal(t, UserData, NewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tString())\n}\n```\n\n- Bytes\n\n```go\n// response_test.go\n\nfunc TestResponse_Bytes(t *testing.T) {\n\tassert.Equal(t, []byte(UserData), NewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tBytes())\n}\n\n```\n#### Bind Body\n\nIf type of data in body is JSON, you can unmarshal it straightly\n\n```go\n// response_test.go\n\ntype (\n\tUser struct {\n\t\tId   uint   \n\t\tName string\n\t}\n)\n\nfunc TestResponse_Bind(t *testing.T) {\n\tuser := new(User)\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tBind(user)\n\tassert.Equal(t, user.Id, uint(1))\n\tassert.Equal(t, user.Name, \"hexi\")\n}\n```\n\n#### Body Types\n\nYou can return data in 4 types\n\n* [JSON](#json)\n* [XML](#xml)\n* [MD5](#md5)\n* [SHA1](#sha1)\n\n\n#### As http.Response\n\n\u003e As *http.Response is embedded in htest.Response, you can regard *htest.Response as *http.Response. Just like: \n\n```go\n\nassert.Equal(t, \"HTTP/1.1\", NewClient(t).\n                        \t\tTo(Mux).\n                        \t\tGet(\"/body/user\").\n                        \t\tTest().\n                        \t\tProto\n)\n    \n```\n\n### Body\n\nhtest provide 4 types of data to be returned\n\n#### JSON\n\ndata as JSON\n\n##### Assert JSON Key\n\n- Exist(key string)\n- NotExist(key string)\n- String(key, expect string)\n- Int(key string, expect int64)\n- True(key string)\n- False(key string)\n- Uint(key string, expect uint64)\n- Time(key string, expect time.Time)\n- Float(key string, expect float64)\n\n```go\n// body_test.go\n\nfunc TestJSON_Exist(t *testing.T) {\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/name\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tExist(\"name\").\n\t\tNotExist(\"stuid\")\n}\n\n```\n\n```go\nfunc TestJSON_String(t *testing.T) {\n\tuser := new(User)\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tString(\"name\", \"hexi)\n}\n```\n\n##### Assert JSON Empty or Not\n\n```go\nfunc TestJSON_NotEmpty(t *testing.T) {\n\tuser := new(User)\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tNotEmpty()\n}\n```\n\n##### Bind JSON\n\n```go\n// body_test.go\n\ntype (\n\tUser struct {\n\t\tId   uint   \n\t\tName string\n\t}\n)\n\nfunc TestJSON_Bind(t *testing.T) {\n\tuser := new(User)\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tJSON().\n\t\tBind(user)\n\tassert.Equal(t, user.Id, uint(1))\n\tassert.Equal(t, user.Name, \"hexi\")\n}\n```\n\n#### XML\n\nSame as JSON.\n\nFor more examples, you can find them in body_test.go\n\n#### MD5\n\n##### Assert MD5 Hash\n\n```go\n// body_test.go\n\nfunc TestMD5_Expect(t *testing.T) {\n\tNewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tMD5().\n\t\tExpect(UserDataMD5)\n}\n```\n\n##### Get MD5 Hash value\n\n```go\nhash := NewClient(t).\n\t\tTo(Mux).\n\t\tGet(\"/body/user\").\n\t\tTest().\n\t\tStatusOK().\n\t\tMD5().\n\t\tBody()\n```\n\n#### SHA1\n\nSame as MD5.\n\nFor more examples, you can find them in body_test.go\n\n\n### Appendix\n\n#### consts\n\nThere are many constants of header or header value in const.go\n\n```go\n// const.go\n\npackage htest\n\n// HTTP methods\nconst (\n\tCONNECT = \"CONNECT\"\n\tDELETE  = \"DELETE\"\n\tGET     = \"GET\"\n\tHEAD    = \"HEAD\"\n\tOPTIONS = \"OPTIONS\"\n\tPATCH   = \"PATCH\"\n\tPOST    = \"POST\"\n\tPUT     = \"PUT\"\n\tTRACE   = \"TRACE\"\n)\n\n// MIME types\nconst (\n\tMIMEApplicationJSON                  = \"application/json\"\n\tMIMEApplicationJSONCharsetUTF8       = MIMEApplicationJSON + \"; \" + charsetUTF8\n\tMIMEApplicationJavaScript            = \"application/javascript\"\n\tMIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + \"; \" + charsetUTF8\n\tMIMEApplicationXML                   = \"application/xml\"\n\tMIMEApplicationXMLCharsetUTF8        = MIMEApplicationXML + \"; \" + charsetUTF8\n\tMIMETextXML                          = \"text/xml\"\n\tMIMETextXMLCharsetUTF8               = MIMETextXML + \"; \" + charsetUTF8\n\tMIMEApplicationForm                  = \"application/x-www-form-urlencoded\"\n\tMIMEApplicationProtobuf              = \"application/protobuf\"\n\tMIMEApplicationMsgpack               = \"application/msgpack\"\n\tMIMETextHTML                         = \"text/html\"\n\tMIMETextHTMLCharsetUTF8              = MIMETextHTML + \"; \" + charsetUTF8\n\tMIMETextPlain                        = \"text/plain\"\n\tMIMETextPlainCharsetUTF8             = MIMETextPlain + \"; \" + charsetUTF8\n\tMIMEMultipartForm                    = \"multipart/form-data\"\n\tMIMEOctetStream                      = \"application/octet-stream\"\n)\n\nconst (\n\tcharsetUTF8 = \"charset=UTF-8\"\n)\n\n// Headers\nconst (\n\tHeaderAccept              = \"Accept\"\n\tHeaderAcceptEncoding      = \"Accept-Encoding\"\n\tHeaderAllow               = \"Allow\"\n\tHeaderAuthorization       = \"Authorization\"\n\tHeaderContentDisposition  = \"Content-Disposition\"\n\tHeaderContentEncoding     = \"Content-Encoding\"\n\tHeaderContentLength       = \"Content-Length\"\n\tHeaderContentType         = \"Content-Type\"\n\tHeaderCookie              = \"Cookie\"\n\tHeaderSetCookie           = \"Set-Cookie\"\n\tHeaderIfModifiedSince     = \"If-Modified-Since\"\n\tHeaderLastModified        = \"Last-Modified\"\n\tHeaderLocation            = \"Location\"\n\tHeaderUpgrade             = \"Upgrade\"\n\tHeaderVary                = \"Vary\"\n\tHeaderWWWAuthenticate     = \"WWW-Authenticate\"\n\tHeaderXForwardedFor       = \"X-Forwarded-For\"\n\tHeaderXForwardedProto     = \"X-Forwarded-Proto\"\n\tHeaderXForwardedProtocol  = \"X-Forwarded-Protocol\"\n\tHeaderXForwardedSsl       = \"X-Forwarded-Ssl\"\n\tHeaderXUrlScheme          = \"X-Url-Scheme\"\n\tHeaderXHTTPMethodOverride = \"X-HTTP-Method-Override\"\n\tHeaderXRealIP             = \"X-Real-IP\"\n\tHeaderXRequestID          = \"X-Request-ID\"\n\tHeaderServer              = \"Server\"\n\tHeaderOrigin              = \"Origin\"\n\n\t// Access control\n\tHeaderAccessControlRequestMethod    = \"Access-Control-Request-Method\"\n\tHeaderAccessControlRequestHeaders   = \"Access-Control-Request-Headers\"\n\tHeaderAccessControlAllowOrigin      = \"Access-Control-Allow-Origin\"\n\tHeaderAccessControlAllowMethods     = \"Access-Control-Allow-Methods\"\n\tHeaderAccessControlAllowHeaders     = \"Access-Control-Allow-Headers\"\n\tHeaderAccessControlAllowCredentials = \"Access-Control-Allow-Credentials\"\n\tHeaderAccessControlExposeHeaders    = \"Access-Control-Expose-Headers\"\n\tHeaderAccessControlMaxAge           = \"Access-Control-Max-Age\"\n\n\t// Security\n\tHeaderStrictTransportSecurity = \"Strict-Transport-Security\"\n\tHeaderXContentTypeOptions     = \"X-Content-Type-Options\"\n\tHeaderXXSSProtection          = \"X-XSS-Protection\"\n\tHeaderXFrameOptions           = \"X-Frame-Options\"\n\tHeaderContentSecurityPolicy   = \"Content-Security-Policy\"\n\tHeaderXCSRFToken              = \"X-CSRF-Token\"\n)\n\n\n```\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexilee%2Fhtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexilee%2Fhtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexilee%2Fhtest/lists"}