This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
Prioritizes returning an https url over http with 'shopify tunnel status' #1221
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 are these changes introduced?
While using
shopify tunnel
for the first time to test out a local shopify extension over HTTPS via an ngrok tunnel, I noticed an interesting difference in the output of the following commands:shopify tunnel start
outputs an HTTPS URLshopify tunnel status
outputs an HTTP URLIMO, to offer a more secure user experience by default, we should always be outputting an HTTPS URL instead of HTTP whenever possible.
WHAT is this pull request doing?
Before, the
shopify tunnel status
command would get all URLs for the ngrok tunnel and just return the first one. As of writing, ngrok returns the HTTP URL before the HTTPS one, so the HTTP URL would return first.Now, I am using
Enumerable#find
to return the very first HTTPS URL. If none exists, then I fallback to existing behaviour (return the first available URL and output the same message as before).NOTE: I have made an educated guess that this kind of change warrants a PATCH version bump. Therefore, I've incremented the version from 1.10.0 to 1.10.1. Feel free to instruct me to change my approach if necessary.
Testing
This was done from an extension I just created with
shopify create extension
, using the latest version of Shopify CLI downloaded from Homebrew:Update checklist