-
Notifications
You must be signed in to change notification settings - Fork 637
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
Add missing content type header for assets to metro server. #953
Closed
aleqsio
wants to merge
4
commits into
facebook:main
from
aleqsio:codespace-aleqsio-ideal-palm-tree-wx6vj66r66h9wqr
Closed
Add missing content type header for assets to metro server. #953
aleqsio
wants to merge
4
commits into
facebook:main
from
aleqsio:codespace-aleqsio-ideal-palm-tree-wx6vj66r66h9wqr
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
motiz88
requested changes
Mar 21, 2023
motiz88
approved these changes
Mar 22, 2023
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
pushed a commit
that referenced
this pull request
Mar 31, 2023
Summary: This PR relates to PR #953 and adds the `Content-Length` property when loading assets. While this isn't mandatory for the apps, it's extremely useful for some debugging possibilities. At Expo, we are working on debugging improvements through Chrome DevTools, and one of these improvements is adding support for the Network inspector. On the native side, we are limited to what we can infer automatically. One of these limitations is intercepting response bodies. We can't intercept these response bodies if it's larger than 1mb, and because of that, we rely on the `Content-Length` header to communicate the size of the response. Pull Request resolved: #961 Test Plan: <img width="1312" alt="image" src="https://user-images.githubusercontent.com/1203991/228896070-61c4c3a4-578f-472a-b6e8-cfe7b2b8e624.png"> I can provide a repository to try this debugger, if it's necessary. You can also test this change by manually loading an existing asset (e.g. `http://localhost/assets/icon.png?platform=android`) and check the response headers in the same debugger. Reviewed By: robhogan Differential Revision: D44544314 Pulled By: huntie fbshipit-source-id: 72da30b0822077e1dc5556a809bed5a67359595e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Merged
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.
Summary
I'm a maintainer of
expo-image
on the web platform.To support rendering svg assets by passing the URI to the
<img>
src prop, it's necessary for the asset url to return the correct content type.The solution follows the code described in this issue, and was tested to work and allow using SVG assets on web in an expected way.
Fixes #394.
Test plan
SVG returned as text without the patch in this PR:

SVG rendered correctly on asset URL after applying the patch:

Expected content type:
