Files
cypress/packages/server/lib/util/origin.js
T
Zach Bloomquist 74dc6e8b5e Only send cy.visit() auth options to correct protection space (#4338)
* only send auth headers to the original protection space

* cleanup

* test now fails w/o fix

* note about moving this into lib/util/uri.js

* refactor, cleanup, and provide more context

* add lots of tests around cors.urlMatchesOriginProtectionSpace

- fix some edge cases and yes… bugs due to behavior of url.format(…)
- if host is set, port value is ignored, so we must clear it out
- protocol contains a ‘:’ character, fixed the protocol + port constants
- synchronize method signatures to always return a safely cloned
url.parse(…) object
- add url notes

* have buffers use url utility

* fixes failing tests

* remove unused require


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-06-19 06:23:25 -04:00

15 lines
284 B
JavaScript

// TODO: move this into lib/util/uri.js
const url = require('url')
module.exports = function (urlStr) {
const parsed = url.parse(urlStr)
parsed.hash = null
parsed.search = null
parsed.query = null
parsed.path = null
parsed.pathname = null
return url.format(parsed)
}