Skip to content

Commit

Permalink
Fix linter issues. Fix domain to test redirect.
Browse files Browse the repository at this point in the history
  • Loading branch information
abogdanov37 committed Jul 2, 2024
1 parent cf92cd8 commit e39cf04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions api/internal/loader/fileloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ type FileLoader struct {
cleaner func() error
}

// This redirect code does not process automaticali by http client and we can process it manualy
const MULTIPLE_CHOICES_REDIRECT_CODE = 300
// This redirect code does not process automaticaly by http client and we can process it manually
const MultipleChoicesRedirectCode = 300

// Repo returns the absolute path to the repo that contains Root if this fileLoader was created from a url
// or the empty string otherwise.
Expand Down Expand Up @@ -321,7 +321,7 @@ func (fl *FileLoader) httpClientGetContent(path string) ([]byte, error) {
defer resp.Body.Close()
// response unsuccessful
if resp.StatusCode < 200 || resp.StatusCode > 299 {
if resp.StatusCode == MULTIPLE_CHOICES_REDIRECT_CODE {
if resp.StatusCode == MultipleChoicesRedirectCode {
var newPath string = resp.Header.Get("Location")
return nil, &RedirectionError{
Msg: "Response is redirect",
Expand Down
4 changes: 2 additions & 2 deletions api/internal/loader/fileloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,10 @@ func TestLoaderHTTP(t *testing.T) {
},
}
for _, x := range testCaseRedirect {
expectedLocation := "https://redirect.com/resource.yaml"
expectedLocation := "https://test.com/resource.yaml"
hc := makeFakeHTTPClient(func(req *http.Request) *http.Response {
response := &http.Response{
StatusCode: 300,
StatusCode: MultipleChoicesRedirectCode,
Body: io.NopCloser(bytes.NewBufferString("")),
Header: make(http.Header),
}
Expand Down

0 comments on commit e39cf04

Please sign in to comment.