diff options
| author | Shulhan <ms@kilabit.info> | 2024-06-08 23:11:52 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-06-08 23:11:52 +0700 |
| commit | 274ef1036f8a73ec0af058b843657f9e24184475 (patch) | |
| tree | 7a3fe0f170126bdb0b39b8209097846579f75806 | |
| parent | c8b408fc32fcaba43f69bd494305c52cbdeb06c6 (diff) | |
| download | pakakeh.go-274ef1036f8a73ec0af058b843657f9e24184475.tar.xz | |
lib/http: add request type HTML
The RequestTypeHTML define the content type "text/html".
| -rw-r--r-- | lib/http/client.go | 2 | ||||
| -rw-r--r-- | lib/http/client_request.go | 2 | ||||
| -rw-r--r-- | lib/http/endpoint.go | 2 | ||||
| -rw-r--r-- | lib/http/request_type.go | 3 |
4 files changed, 6 insertions, 3 deletions
diff --git a/lib/http/client.go b/lib/http/client.go index 751b1de3..d5045fee 100644 --- a/lib/http/client.go +++ b/lib/http/client.go @@ -208,7 +208,7 @@ func (client *Client) GenerateHTTPRequest(req ClientRequest) (httpReq *http.Requ ) switch req.Type { - case RequestTypeNone, RequestTypeXML: + case RequestTypeNone, RequestTypeHTML, RequestTypeXML: // NOOP. case RequestTypeQuery: diff --git a/lib/http/client_request.go b/lib/http/client_request.go index 55cf3ab3..48ffb52b 100644 --- a/lib/http/client_request.go +++ b/lib/http/client_request.go @@ -96,7 +96,7 @@ func (creq *ClientRequest) toHTTPRequest(client *Client) (httpReq *http.Request, RequestMethodPut: switch creq.Type { - case RequestTypeNone, RequestTypeXML: + case RequestTypeNone, RequestTypeHTML, RequestTypeXML: // NOOP. case RequestTypeQuery: diff --git a/lib/http/endpoint.go b/lib/http/endpoint.go index 5763cf8d..58ac2712 100644 --- a/lib/http/endpoint.go +++ b/lib/http/endpoint.go @@ -69,7 +69,7 @@ func (ep *Endpoint) call( req.Body = io.NopCloser(bytes.NewBuffer(epr.RequestBody)) switch ep.RequestType { - case RequestTypeNone, RequestTypeXML: + case RequestTypeNone, RequestTypeHTML, RequestTypeXML: // NOOP. case RequestTypeForm, RequestTypeQuery, RequestTypeJSON: diff --git a/lib/http/request_type.go b/lib/http/request_type.go index c6310e87..2a79b6df 100644 --- a/lib/http/request_type.go +++ b/lib/http/request_type.go @@ -12,6 +12,7 @@ const ( RequestTypeNone RequestType = `` RequestTypeQuery RequestType = `query` RequestTypeForm RequestType = `form-urlencoded` + RequestTypeHTML RequestType = `html` RequestTypeMultipartForm RequestType = `form-data` RequestTypeJSON RequestType = `json` RequestTypeXML RequestType = `xml` @@ -26,6 +27,8 @@ func (rt RequestType) String() string { return `` case RequestTypeForm: return ContentTypeForm + case RequestTypeHTML: + return ContentTypeHTML case RequestTypeMultipartForm: return ContentTypeMultipartForm case RequestTypeJSON: |
