diff --git a/packages/driver/cypress/integration/commands/request_spec.js b/packages/driver/cypress/integration/commands/request_spec.js index b44ca47346bc..669d1acacf93 100644 --- a/packages/driver/cypress/integration/commands/request_spec.js +++ b/packages/driver/cypress/integration/commands/request_spec.js @@ -754,7 +754,7 @@ describe('src/cy/commands/request', () => { .resolves({ isOkStatusCode: true, status: 201 }) cy.request('http://localhost:8080/foo').then(function () { - expect(this.lastLog.invoke('renderProps').message).to.equal('GET 201 http://localhost:8080/foo') + expect(this.lastLog.invoke('renderProps').message).to.equal('GET 201 /foo') }) }) }) diff --git a/packages/driver/src/cy/commands/request.ts b/packages/driver/src/cy/commands/request.ts index fe71b312d9ce..20de613adbe3 100644 --- a/packages/driver/src/cy/commands/request.ts +++ b/packages/driver/src/cy/commands/request.ts @@ -51,6 +51,12 @@ const whichAreOptional = (val, key) => { return (val === null) && OPTIONAL_OPTS.includes(key) } +const stripOrigin = (url) => { + const location = $Location.create(url) + + return url.replace(location.origin, '') +} + const needsFormSpecified = (options: any = {}) => { const { body, json, headers } = options @@ -273,7 +279,7 @@ export default (Commands, Cypress, cy, state, config) => { } return { - message: `${options.method} ${status} ${options.url}`, + message: `${options.method} ${status} ${stripOrigin(options.url)}`, indicator, } },