diff --git a/CHANGELOG.md b/CHANGELOG.md index 7da1e1a..b9a114f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed * fix update index.js in install generatpr [PR 147](https://github.com/shakacode/cypress-on-rails/pull/147) by [Judahmeek] +* Support rails 7.1 by adding content-type header to generated on-rails.js file [PR 148](https://github.com/shakacode/cypress-on-rails/pull/148) by [anark] ## [1.16.0] [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.15.1...v1.16.0 diff --git a/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js b/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js index 534d5eb..79e8eca 100644 --- a/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +++ b/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js @@ -6,6 +6,9 @@ Cypress.Commands.add('appCommands', function (body) { method: 'POST', url: "/__e2e__/command", body: JSON.stringify(body), + headers: { + 'Content-Type': 'application/json', + }, log: false, failOnStatusCode: false }).then((response) => { @@ -52,6 +55,9 @@ Cypress.on('fail', (err, runnable) => { Cypress.$.ajax({ url: '/__e2e__/command', data: JSON.stringify({name: 'log_fail', options: {error_message: err.message, runnable_full_title: runnable.fullTitle() }}), + headers: { + 'Content-Type': 'application/json', + }, async: false, method: 'POST' });