Skip to content

Commit

Permalink
Merge branch 'main' into 682-dataset-task-list-fetch-data-from-all-ac…
Browse files Browse the repository at this point in the history
…tive-resources
  • Loading branch information
GeorgeGoodall-GovUk authored Dec 12, 2024
2 parents 70f35d8 + f15459a commit b3240e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/controllers/submitUrlController.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ class SubmitUrlController extends UploadController {
if (!response) {
return false
}

try {
return (response.status >= 200 && response.status < 300) || response.status === 400 // need to add 400 as some servers return 400 for head requests
return response.status !== 404 // Allow everything except 404, we cannot be sure what the server will return for HEAD requests
} catch (err) {
logger.warn(err)
return true
Expand Down
4 changes: 2 additions & 2 deletions test/unit/submitUrlController.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ describe('SubmitUrlController', async () => {
expect(SubmitUrlController.isUrlAccessible({ status: 200 })).toBe(true)
})

it('should return false for URLs that exist with a 3XX status code', async () => {
expect(SubmitUrlController.isUrlAccessible({ status: 301 })).toBe(false)
it('should return true for URLs that exist with a 3XX status code', async () => {
expect(SubmitUrlController.isUrlAccessible({ status: 301 })).toBe(true)
})

it('should return false for URLs that exist with a 4XX status code', async () => {
Expand Down

0 comments on commit b3240e1

Please sign in to comment.