Skip to content

Commit

Permalink
Merge pull request #760 from Availity/feature/fixFilesDelivery
Browse files Browse the repository at this point in the history
fix: don't append FUD id twice
  • Loading branch information
jordan-a-young authored Sep 19, 2024
2 parents 9827d84 + 1aa850d commit b856349
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/api-axios/src/resources/filesDelivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default class AvFilesDeliveryApi extends AvMicroserviceApi {

getLocation(response) {
const baseUrl = super.getLocation(response);
return `${baseUrl}/${response.data.id}`;
const { id } = response.data;
return !id || baseUrl.endsWith(id) ? `${baseUrl}` : `${baseUrl}/${id}`;
}
}

Expand Down
9 changes: 9 additions & 0 deletions packages/api-axios/src/resources/tests/filesDelivery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ describe('AvFileDelivery', () => {
);
});

test('polling url should be correct', () => {
expect(api.getLocation({ headers: { Location: '/ms/api/availity/internal/platform/file-upload-delivery/v1/batch/deliveries/id123'}, data: { id: 'id123'}, config: {}})).toBe(
'http://localhost:8080/ms/api/availity/internal/platform/file-upload-delivery/v1/batch/deliveries/id123'
);
expect(api.getLocation({ headers: { Location: '/ms/api/availity/internal/platform/file-upload-delivery/v1/batch/deliveries/id123'}, data: {}, config: {}})).toBe(
'http://localhost:8080/ms/api/availity/internal/platform/file-upload-delivery/v1/batch/deliveries/id123'
);
});

test('uploadFile() should call create for reference passed', async () => {
const data = {
deliveries: [
Expand Down

0 comments on commit b856349

Please sign in to comment.