Skip to content
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

Added test for images w/o extensions #109

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

aileen
Copy link
Collaborator

@aileen aileen commented Jan 4, 2018

closes #97

Images without extensions don't need to be manipulated, as we're now reading the bytes and pass those to the image-size lib.

This PR adds another user-agent to emulate multiple browser requests, as I stumbled over an example where the image without extension is protected otherwise.

Added a test, that works with above mentioned image, but is currently mocked. Nevertheless, the image worked as a PoC, that we're able to read the bytes of an image without its extension and still return a valid amp-img tag.

Updated the README, as there were some code typos in there 🙈.

// This test is mocked, but works with this specific example.
// You can comment out the mocks and the test should still pass.
sizeOfMock = nock('https://www.zomato.com')
.get('/logo/18163505/minilogo')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the match headers assertion here as well? 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

closes jbhannah#97

Images without extensions don't need to be manipulated, as we're now reading the bytes and pass those to the `image-size` lib.

This PR adds another `user-agent` to emulate multiple browser requests, as I stumbled over an example where the image without extension is protected otherwise.

Added a test, that works with above mentioned image, but is currently mocked. Nevertheless, the image worked as a PoC, that we're able to read the bytes of an image without its extension and still return a valid `amp-img` tag.

Updated the README, as there were some code typos in there 🙈.
@aileen aileen force-pushed the images-without-extensions branch from 8b54ecd to 01e3514 Compare January 4, 2018 10:43
@coveralls
Copy link

coveralls commented Jan 4, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 01e3514 on AileenCGN:images-without-extensions into aa011f9 on jbhannah:master.

Repository owner deleted a comment from coveralls Jan 4, 2018
@kirrg001 kirrg001 merged commit 1189b1e into jbhannah:master Jan 4, 2018
aileen added a commit to aileen/amperize that referenced this pull request Jan 4, 2018
no issue

Changelog:
- Added test for images w/o extensions (jbhannah#109) and new user-agent for image requests
@aileen aileen mentioned this pull request Jan 4, 2018
kirrg001 pushed a commit that referenced this pull request Jan 4, 2018
no issue

Changelog:
- Added test for images w/o extensions (#109) and new user-agent for image requests
@aileen aileen deleted the images-without-extensions branch May 10, 2018 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Images without extensions cause error in image-size library
3 participants