|
@@ -25,10 +25,10 @@ type HTTPCLientResponse struct {
|
|
|
type HTTPClient struct {
|
|
type HTTPClient struct {
|
|
|
scheme string
|
|
scheme string
|
|
|
host string
|
|
host string
|
|
|
- port uint
|
|
|
|
|
|
|
+ port string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func NewHTTPClient(scheme string, host string, port uint) *HTTPClient {
|
|
|
|
|
|
|
+func NewHTTPClient(scheme string, host string, port string) *HTTPClient {
|
|
|
return &HTTPClient{
|
|
return &HTTPClient{
|
|
|
scheme: scheme,
|
|
scheme: scheme,
|
|
|
host: host,
|
|
host: host,
|
|
@@ -46,7 +46,7 @@ func (this *HTTPClient) Request(method int, path string, headers HTTPHeaders, re
|
|
|
if method == METHOD_GET {
|
|
if method == METHOD_GET {
|
|
|
requestInternal, err = http.NewRequest(
|
|
requestInternal, err = http.NewRequest(
|
|
|
"GET",
|
|
"GET",
|
|
|
- fmt.Sprintf("%s://%s:%d/%s", this.scheme, this.host, this.port, path),
|
|
|
|
|
|
|
+ fmt.Sprintf("%s://%s:%s%s", this.scheme, this.host, this.port, path),
|
|
|
nil,
|
|
nil,
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -54,7 +54,7 @@ func (this *HTTPClient) Request(method int, path string, headers HTTPHeaders, re
|
|
|
if method == METHOD_POST {
|
|
if method == METHOD_POST {
|
|
|
requestInternal, err = http.NewRequest(
|
|
requestInternal, err = http.NewRequest(
|
|
|
"POST",
|
|
"POST",
|
|
|
- fmt.Sprintf("%s://%s:%d/%s", this.scheme, this.host, this.port, path),
|
|
|
|
|
|
|
+ fmt.Sprintf("%s://%s:%s%s", this.scheme, this.host, this.port, path),
|
|
|
bytes.NewBuffer(buffer),
|
|
bytes.NewBuffer(buffer),
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -87,7 +87,7 @@ func (this *HTTPClient) Request(method int, path string, headers HTTPHeaders, re
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var contentType string
|
|
var contentType string
|
|
|
- if contentTypeHeader == "text/plain" || contentTypeHeader == "application/octet-stream" {
|
|
|
|
|
|
|
+ if contentTypeHeader == "text/plain" || contentTypeHeader == "application/json" || contentTypeHeader == "application/octet-stream" {
|
|
|
contentType = contentTypeHeader
|
|
contentType = contentTypeHeader
|
|
|
} else {
|
|
} else {
|
|
|
parts := strings.Split(contentTypeHeader, ";")
|
|
parts := strings.Split(contentTypeHeader, ";")
|