Skip to content

Commit

Permalink
temporarily renamed some test files to improve package readability fo…
Browse files Browse the repository at this point in the history
…r squashing
  • Loading branch information
thejoeker12 committed Jul 9, 2024
1 parent 66582e2 commit d30fb5a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
3 changes: 1 addition & 2 deletions response/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ func parseHTMLResponse(bodyBytes []byte, apiError *APIError) {
}
}

parse(doc) // Start parsing the document.
parse(doc)

// Concatenate all accumulated messages and links with a separator.
if len(messages) > 0 {
apiError.Message = strings.Join(messages, "; ")
} else {
// Fallback error message if no specific content was extracted.
apiError.Message = "HTML Error: See 'Raw' field for details."
}

Expand Down
9 changes: 0 additions & 9 deletions response/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ import (
)

// IsRedirectStatusCode checks if the provided HTTP status code is one of the redirect codes.
// Redirect status codes instruct the client to make a new request to a different URI, as defined in the response's Location header.
//
// - 301 Moved Permanently: The requested resource has been assigned a new permanent URI and any future references to this resource should use one of the returned URIs.
// - 302 Found: The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client should continue to use the Request-URI for future requests.
// - 303 See Other: The response to the request can be found under a different URI and should be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource.
// - 307 Temporary Redirect: The requested resource resides temporarily under a different URI. The client should not change the request method if it performs an automatic redirection to that URI.
// - 308 Permanent Redirect: The request and all future requests should be repeated using another URI. 308 parallel the behavior of 301 but do not allow the HTTP method to change. So, for example, submitting a form to a permanently redirected resource may continue smoothly.
//
// The function returns true if the statusCode is one of the above redirect statuses, indicating that the client should follow the redirection as specified in the Location header of the response.
func IsRedirectStatusCode(statusCode int) bool {
switch statusCode {
case http.StatusMovedPermanently,
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions response/success_test.go → response/t_success_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ func TestHandleDeleteRequest_Success(t *testing.T) {
},
}

// Call handleDeleteRequest with a nil logger since logging is ignored in this test
err := handleDeleteRequest(resp, nil)

// No error is expected for a successful DELETE request
assert.NoError(t, err, "handleDeleteRequest should not return an error for successful DELETE requests")
}

Expand All @@ -42,9 +40,7 @@ func TestHandleDeleteRequest_Failure(t *testing.T) {
},
}

// Call handleDeleteRequest with a nil logger since logging is ignored in this test
err := handleDeleteRequest(resp, nil)

// An error is expected for a failed DELETE request
assert.Error(t, err, "handleDeleteRequest should return an error for failed DELETE requests")
}

0 comments on commit d30fb5a

Please sign in to comment.