-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(http)!: enhance blob handling in HttpClient #2181
Merged
Merged
Conversation
This file contains 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
🦋 Changeset detectedLatest commit: e3af32b The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
github-actions
bot
added
🚀 feature
New feature or request
🧨 breaking changes
🧬 Modules
📚 documentation
Improvements or additions to documentation
labels
May 23, 2024
odinr
force-pushed
the
feat/http/improve-blob-requests
branch
from
May 24, 2024 09:33
5fad73b
to
65704c5
Compare
Coverage Report
File Coverage
|
odinr
force-pushed
the
feat/http/improve-blob-requests
branch
from
May 27, 2024 10:07
276da48
to
fc51e93
Compare
eikeland
approved these changes
May 27, 2024
- Update `blob` and `blob$` methods to accept `FetchRequestInit<T>` args - Return `Promise<BlobResult>` and `StreamResponse<BlobResult>` from `blob` and `blob$` methods - `BlobResult` includes filename (if available) and blob data - Update `blobSelector` to extract filename from 'content-disposition' header - Add JSDoc comments for improved documentation The `blob` and `blob$` methods now provide a more robust and flexible API for fetching blob resources. This change introduces a breaking change in the return types of these methods. BREAKING CHANGE: The `blob` and `blob$` methods now return `Promise<BlobResult>` and `StreamResponse<BlobResult>` instead of `Promise<Blob>` and `StreamResponse<Blob>`. The `BlobResult` type includes the filename (if available) and the blob data.
…nges in IHttpClient
Update PeopleApiClient.photo method to return PersonPhotoApiResponse instead of Blob since the IHttpClient interface has changed Adjust related types and methods to handle the updated return type Modify PersonController to map the API response to Blob and handle errors appropriately
odinr
force-pushed
the
feat/http/improve-blob-requests
branch
from
May 27, 2024 10:39
fc51e93
to
e3af32b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🧨 breaking changes
📚 documentation
Improvements or additions to documentation
🚀 feature
New feature or request
🧬 Modules
👾 React
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.
Why
This pull request introduces a major update to the
blob
andblob$
methods in theHttpClient
class of the@equinor/fusion-framework-module-http
package.Current Behavior
The existing
blob
andblob$
methods in theHttpClient
class return aBlob
or aStreamResponse<Blob>
respectively, without providing any information about the filename of the fetched blob.New Behavior
The updated
blob
andblob$
methods now accept an optionalargs
parameter of typeFetchRequestInit<T, TRequest, TResponse>
, whereT
is the type of the expected blob result. This allows consumers to customize the fetch request and response handling.Additionally, the
blob
andblob$
methods now return aPromise<T>
andStreamResponse<T>
respectively, whereT
is the type of the expected blob result. This allows consumers to handle the blob data in a more type-safe manner.The
blobSelector
function has also been updated to extract the filename (if available) from thecontent-disposition
header and return it along with the blob data in aBlobResult
object.Breaking Change
This update alters the return type of the
blob
andblob$
methods, which is a breaking change. If you were previously using these methods and expecting aBlob
result, you must now use the newBlobResult
type, which includes the filename (if available) and the blob data.Example Usage
Check off the following: