oauth-1.0a
oauth-1.0a copied to clipboard
Exclude default ports 80/443 from base URL
Fix #59
Breaking changes: the URL is validated
too many changes. take me time to review all of them, be patient
this PR only "Exclude default ports 80/443 from base URL"? why take 13 files changes
@ddo Rebased on master
@ddo
Define parseUrl(url)
with the other helpers.
That's crud fix. Maybe we should parse the URL without reg. exp. It would avoid any breaking changes.
i still checking the regex part. any source?
Based on https://en.wikipedia.org/wiki/URL (although I just notice the password part of the auth should be optional). The host is optional but required for OAuth request:
/^
(https?):\/\/ # scheme://
([^:]+:[^@]+@)? # [user[:password]@] (to fix)
([^:/?#]+) # host
(\:\d+)? # [:port]
(\/[^?#]*)? # [/path]
(\?[^#]*)? # [?query]
(#.*)? # [#fragment]
$/
i think we do it too complicated for this simple task?
Possibly. We don't need to extract the scheme + port and later the query with the same regexp.