Skip to content

Commit

Permalink
feat(driver): change request log message (cypress-io#20009)
Browse files Browse the repository at this point in the history
  • Loading branch information
edikdeisling committed Feb 2, 2022
1 parent 2c1ecab commit f34e315
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
})
Expand Down
8 changes: 7 additions & 1 deletion packages/driver/src/cy/commands/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
}
},
Expand Down

0 comments on commit f34e315

Please sign in to comment.