GPHDRUI-427 Upgrade axios from 0.x to 1.18.1 - #164
Merged
Conversation
Bump axios from ^0.30.0 to ^1.18.1 (major upgrade) and review the
codebase for breaking changes.
Dependencies:
- axios: ^0.30.0 -> ^1.18.1
- axios-mock-adapter: ^1.17.0 -> ^1.22.0 (axios 1.x compatibility)
- update yarn.lock accordingly
Breaking-change fixes:
- ContactDocumentService.upload(): drop the manual
"Content-Type: multipart/form-data" header. axios 1.x sets the
multipart Content-Type incl. boundary automatically for FormData.
However, the DomainRobotService constructor installs a global
"application/json" default (axios.defaults.headers.common) that would
otherwise win and break the multipart request, so clear the
Content-Type per request (set to null) to let axios auto-detect it.
This was caught by the new HTTP integration test - the mock-adapter
suite could not surface it.
Bug fixes in the previously unreachable ContactDocumentService:
- fix broken module export (Contact -> ContactDocumentService)
- remove reference to an undefined `axios` variable (obsolete after the
Content-Type change)
- wire the service into Domainrobot via a new contactDocument() factory
so it is reachable through the public API
Tests:
- add unit/mock tests for ContactDocumentService (upload with/without
keys, info, delete)
- add real HTTP integration tests (no axios-mock-adapter) that validate
axios 1.x behaviour the mock suite cannot reach:
- ContactDocument upload: genuine multipart/form-data body with boundary
- DomainRobotService: basic auth + context header on the wire, JSON
response parsing, response headers via AxiosHeaders, 4xx ->
DomainRobotException mapping, connection errors without a response
- DomainService: PUT with verb-suffixed path + JSON body, GET with
dotted domain name, keys[] query string kept intact on the wire
(params serialization change does not affect this SDK), body-less POST
- add "test:integration" npm script (runs tests/Integration/** separately
from the mock suite so the global mock adapter does not intercept real
requests)
Unaffected by the upgrade (verified): basic auth config, global default
headers, request/response flow, error handling via error.response, and
parameter serialization (URLs are built manually, `params` is not used).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bump axios from ^0.30.0 to ^1.18.1 (major upgrade) and review the codebase for breaking changes.
Dependencies:
Breaking-change fixes:
Bug fixes in the previously unreachable ContactDocumentService:
axiosvariable (obsolete after the Content-Type change)Tests:
Unaffected by the upgrade (verified): basic auth config, global default headers, request/response flow, error handling via error.response, and parameter serialization (URLs are built manually,
paramsis not used).