Skip to content

Commit

Permalink
http enhance
Browse files Browse the repository at this point in the history
  • Loading branch information
AbericYang committed Jun 19, 2020
1 parent 0f5da95 commit 2d976e4
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func HTTPPatchJSON(url string, model interface{}) (resp *http.Response, err erro
return HTTPPatchJSONTLS(url, model, &HTTPTLSConfig{})
}

// HTTPDeleteJSON delete 请求
func HTTPDeleteJSON(url string, model interface{}) (resp *http.Response, err error) {
return HTTPDeleteJSONTLS(url, model, &HTTPTLSConfig{})
}

// HTTPPostXML post 请求
//
// content-type=application/xml
Expand All @@ -80,6 +85,11 @@ func HTTPPatchXML(url string, model interface{}) (resp *http.Response, err error
return HTTPPatchXMLTLS(url, model, &HTTPTLSConfig{})
}

// HTTPDeleteXML delete 请求
func HTTPDeleteXML(url string, model interface{}) (resp *http.Response, err error) {
return HTTPDeleteXMLTLS(url, model, &HTTPTLSConfig{})
}

// HTTPPostYaml post 请求
//
// content-type=application/x-yaml
Expand All @@ -101,6 +111,11 @@ func HTTPPatchYaml(url string, model interface{}) (resp *http.Response, err erro
return HTTPPatchYamlTLS(url, model, &HTTPTLSConfig{})
}

// HTTPDeleteYaml delete 请求
func HTTPDeleteYaml(url string, model interface{}) (resp *http.Response, err error) {
return HTTPDeleteYamlTLS(url, model, &HTTPTLSConfig{})
}

// HTTPPostMsgPack post 请求
//
// content-type=application/x-msgpack
Expand All @@ -122,6 +137,11 @@ func HTTPPatchMsgPack(url string, model interface{}) (resp *http.Response, err e
return HTTPPatchMsgPackTLS(url, model, &HTTPTLSConfig{})
}

// HTTPDeleteMsgPack delete 请求
func HTTPDeleteMsgPack(url string, model interface{}) (resp *http.Response, err error) {
return HTTPDeleteMsgPackTLS(url, model, &HTTPTLSConfig{})
}

// HTTPPostProtoBuf post 请求
//
// content-type=application/x-protobuf
Expand All @@ -143,6 +163,11 @@ func HTTPPatchProtoBuf(url string, pm proto.Message) (resp *http.Response, err e
return HTTPPatchProtoBufTLS(url, pm, &HTTPTLSConfig{})
}

// HTTPDeleteProtoBuf delete 请求
func HTTPDeleteProtoBuf(url string, pm proto.Message) (resp *http.Response, err error) {
return HTTPDeleteProtoBufTLS(url, pm, &HTTPTLSConfig{})
}

// HTTPDelete delete 请求
func HTTPDelete(url string) (resp *http.Response, err error) {
return HTTPDeleteTLS(url, &HTTPTLSConfig{})
Expand Down Expand Up @@ -179,6 +204,11 @@ func HTTPPatchJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (
return HTTPPatchJSONTLSBytes(url, model, tlsConfig.trans())
}

// HTTPDeleteJSONTLS delete tls 请求
func HTTPDeleteJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error) {
return HTTPDeleteJSONTLSBytes(url, model, tlsConfig.trans())
}

// HTTPPostXMLTLS post tls 请求
//
// content-type=application/xml
Expand All @@ -200,6 +230,11 @@ func HTTPPatchXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (r
return HTTPPatchXMLTLSBytes(url, model, tlsConfig.trans())
}

// HTTPDeleteXMLTLS delete tls 请求
func HTTPDeleteXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error) {
return HTTPDeleteXMLTLSBytes(url, model, tlsConfig.trans())
}

// HTTPPostYamlTLS post tls 请求
//
// content-type=application/x-yaml
Expand All @@ -221,6 +256,11 @@ func HTTPPatchYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (
return HTTPPatchYamlTLSBytes(url, model, tlsConfig.trans())
}

// HTTPDeleteYamlTLS delete tls 请求
func HTTPDeleteYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error) {
return HTTPDeleteYamlTLSBytes(url, model, tlsConfig.trans())
}

// HTTPPostMsgPackTLS post tls 请求
//
// content-type=application/x-msgpack
Expand All @@ -242,6 +282,11 @@ func HTTPPatchMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig
return HTTPPatchMsgPackTLSBytes(url, model, tlsConfig.trans())
}

// HTTPDeleteMsgPackTLS delete tls 请求
func HTTPDeleteMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error) {
return HTTPDeleteMsgPackTLSBytes(url, model, tlsConfig.trans())
}

// HTTPPostProtoBufTLS post tls 请求
//
// content-type=application/x-protobuf
Expand All @@ -263,6 +308,11 @@ func HTTPPatchProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig
return HTTPPatchProtoBufTLSBytes(url, pm, tlsConfig.trans())
}

// HTTPDeleteProtoBufTLS delete tls 请求
func HTTPDeleteProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error) {
return HTTPDeleteProtoBufTLSBytes(url, pm, tlsConfig.trans())
}

// HTTPDeleteTLS delete tls 请求
func HTTPDeleteTLS(url string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error) {
return HTTPDeleteTLSBytes(url, tlsConfig.trans())
Expand Down Expand Up @@ -299,6 +349,11 @@ func HTTPPatchJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSByte
return httpRequestJSON(http.MethodPatch, url, model, tlsConfig)
}

// HTTPDeleteJSONTLSBytes delete tls 请求
func HTTPDeleteJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error) {
return httpRequestJSON(http.MethodDelete, url, model, tlsConfig)
}

// HTTPPostXMLTLSBytes post tls 请求
//
// content-type=application/xml
Expand All @@ -320,6 +375,11 @@ func HTTPPatchXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytes
return httpRequestXML(http.MethodPatch, url, model, tlsConfig)
}

// HTTPDeleteXMLTLSBytes delete tls 请求
func HTTPDeleteXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error) {
return httpRequestXML(http.MethodDelete, url, model, tlsConfig)
}

// HTTPPostYamlTLSBytes post tls 请求
//
// content-type=application/x-yaml
Expand All @@ -341,6 +401,11 @@ func HTTPPatchYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSByte
return httpRequestYaml(http.MethodPatch, url, model, tlsConfig)
}

// HTTPDeleteYamlTLSBytes delete tls 请求
func HTTPDeleteYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error) {
return httpRequestYaml(http.MethodDelete, url, model, tlsConfig)
}

// HTTPPostMsgPackTLSBytes post tls 请求
//
// content-type=application/x-msgpack
Expand All @@ -362,6 +427,11 @@ func HTTPPatchMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSB
return httpRequestMsgPack(http.MethodPatch, url, model, tlsConfig)
}

// HTTPDeleteMsgPackTLSBytes delete tls 请求
func HTTPDeleteMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error) {
return httpRequestMsgPack(http.MethodDelete, url, model, tlsConfig)
}

// HTTPPostProtoBufTLSBytes post tls 请求
//
// content-type=application/x-protobuf
Expand All @@ -383,6 +453,13 @@ func HTTPPatchProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSB
return httpRequestProtoBuf(http.MethodPatch, url, pm, tlsConfig)
}

// HTTPDeleteProtoBufTLSBytes delete tls 请求
//
// content-type=application/x-protobuf
func HTTPDeleteProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error) {
return httpRequestProtoBuf(http.MethodDelete, url, pm, tlsConfig)
}

// HTTPDeleteTLSBytes delete tls 请求
func HTTPDeleteTLSBytes(url string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error) {
return httpRequestTLSBytes(http.MethodDelete, url, nil, tlsConfig)
Expand Down

0 comments on commit 2d976e4

Please sign in to comment.