@@ -68,17 +68,6 @@ func (c *Client) CreateRequestURL(location string) string {
6868 return fmt .Sprintf ("%s%s" , c .getBaseURL (), location )
6969}
7070
71- // PerformGetRequest performs a GET request to the specified URL and returns the response body and eventual errors
72- func (c * Client ) PerformGetRequest (url string ) ([]byte , error ) {
73- request , err := http .NewRequest (http .MethodGet , url , nil )
74-
75- if err != nil {
76- return nil , err
77- }
78-
79- return c .performRequest (request )
80- }
81-
8271// PerformJSONGetRequest performs a GET request to the specified URL and returns the response body and eventual errors
8372func (c * Client ) PerformJSONGetRequest (url string ) ([]byte , error ) {
8473 request , err := http .NewRequest (http .MethodGet , url , nil )
@@ -90,23 +79,6 @@ func (c *Client) PerformJSONGetRequest(url string) ([]byte, error) {
9079 return c .performJSONRequest (request )
9180}
9281
93- // PerformPostRequest performs a POST request to the specified URL and returns the response body and eventual errors
94- func (c * Client ) PerformPostRequest (url string , requestBody []byte ) ([]byte , error ) {
95- var bodyReader io.Reader
96-
97- if requestBody != nil {
98- bodyReader = bytes .NewBuffer (requestBody )
99- }
100-
101- request , err := http .NewRequest (http .MethodPost , url , bodyReader )
102-
103- if err != nil {
104- return nil , err
105- }
106-
107- return c .performRequest (request )
108- }
109-
11082// PerformJSONPostRequest performs a POST request to the specified URL and returns the response body and eventual errors
11183func (c * Client ) PerformJSONPostRequest (url string , requestBody []byte ) ([]byte , error ) {
11284 var bodyReader io.Reader
@@ -124,23 +96,6 @@ func (c *Client) PerformJSONPostRequest(url string, requestBody []byte) ([]byte,
12496 return c .performJSONRequest (request )
12597}
12698
127- // PerformPutRequest performs a PUT request to the specified URL and returns the response body and eventual errors
128- func (c * Client ) PerformPutRequest (url string , requestBody []byte ) ([]byte , error ) {
129- var bodyReader io.Reader
130-
131- if requestBody != nil {
132- bodyReader = bytes .NewBuffer (requestBody )
133- }
134-
135- request , err := http .NewRequest (http .MethodPut , url , bodyReader )
136-
137- if err != nil {
138- return nil , err
139- }
140-
141- return c .performRequest (request )
142- }
143-
14499// PerformJSONPutRequest performs a PUT request to the specified URL and returns the response body and eventual errors
145100func (c * Client ) PerformJSONPutRequest (url string , requestBody []byte ) ([]byte , error ) {
146101 var bodyReader io.Reader
@@ -158,18 +113,6 @@ func (c *Client) PerformJSONPutRequest(url string, requestBody []byte) ([]byte,
158113 return c .performJSONRequest (request )
159114}
160115
161- // PerformDeleteRequest performs a DELETE request to the specified URL and returns the response body and eventual errors
162- func (c * Client ) PerformDeleteRequest (url string ) error {
163- request , err := http .NewRequest (http .MethodDelete , url , nil )
164-
165- if err != nil {
166- return err
167- }
168-
169- _ , err = c .performRequest (request )
170- return err
171- }
172-
173116// PerformJSONDeleteRequest performs a DELETE request to the specified URL and returns the response body and eventual errors
174117func (c * Client ) PerformJSONDeleteRequest (url string ) error {
175118 request , err := http .NewRequest (http .MethodDelete , url , nil )
@@ -182,15 +125,6 @@ func (c *Client) PerformJSONDeleteRequest(url string) error {
182125 return err
183126}
184127
185- // Adds common headers to the specified request
186- func (c * Client ) addRequestHeaders (request * http.Request ) * http.Request {
187- request .SetBasicAuth (c .userName , c .password )
188- request .Header .Add ("Accept" , "application/xml" )
189- request .Header .Add ("Content-Type" , "application/xml" )
190-
191- return request
192- }
193-
194128// Adds common headers to the specified request
195129func (c * Client ) addJSONRequestHeaders (request * http.Request ) * http.Request {
196130 request .SetBasicAuth (c .userName , c .password )
@@ -200,18 +134,6 @@ func (c *Client) addJSONRequestHeaders(request *http.Request) *http.Request {
200134 return request
201135}
202136
203- // Performs the specified HTTP request and returns the response through handleResponse()
204- func (c * Client ) performRequest (request * http.Request ) ([]byte , error ) {
205- c .addRequestHeaders (request )
206- response , err := c .httpClient .Do (request )
207-
208- if err != nil {
209- return nil , err
210- }
211-
212- return handleResponse (response )
213- }
214-
215137// Performs the specified HTTP request and returns the response through handleResponse()
216138func (c * Client ) performJSONRequest (request * http.Request ) ([]byte , error ) {
217139 c .addJSONRequestHeaders (request )
0 commit comments