Skip to content

Commit

Permalink
Support 'convert-post-to-get-in-xhr' without service worker (#178)
Browse files Browse the repository at this point in the history
- ensure XHR override is applied even if not using service worker if 'convert post to get' is true, fixes #158
- bump to 3.8.4
- ci: attempt to fix errant test failures than pop up on ci
  • Loading branch information
ikreymer authored Nov 12, 2024
1 parent 7da4fdc commit 2dc83bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ jobs:
node-version: 18.x
- run: yarn install
- run: yarn run build-full-test
- id: setup-chrome
uses: browser-actions/setup-chrome@v1
# set up a virtual display for chrome (since the tests don't currently run it in headless mode)
# then run the tests
- run: |
- name: Run Tests
env:
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
yarn test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webrecorder/wombat",
"version": "3.8.3",
"version": "3.8.4",
"main": "index.js",
"license": "AGPL-3.0-or-later",
"author": "Ilya Kreymer, Webrecorder Software",
Expand Down
7 changes: 3 additions & 4 deletions src/wombat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4549,7 +4549,9 @@ Wombat.prototype.initHTTPOverrides = function() {
// responseURL override
this.overridePropExtract(this.$wbwindow.XMLHttpRequest.prototype, 'responseURL');

if (!this.wb_info.isSW) {
var convertToGet = !!this.wb_info.convert_post_to_get;

if (!this.wb_info.isSW && !convertToGet) {
if (this.$wbwindow.XMLHttpRequest.prototype.open) {
var origXMLHttpOpen = this.$wbwindow.XMLHttpRequest.prototype.open;
this.utilFns.XHRopen = origXMLHttpOpen;
Expand Down Expand Up @@ -4588,9 +4590,6 @@ Wombat.prototype.initHTTPOverrides = function() {
this.__WB_xhr_headers.set(name, value);
};

var wombat = this;
var convertToGet = !!this.wb_info.convert_post_to_get;

this.$wbwindow.XMLHttpRequest.prototype.send = async function(value) {
if (convertToGet && (this.__WB_xhr_open_arguments[0] === 'POST' || this.__WB_xhr_open_arguments[0] === 'PUT')) {

Expand Down

0 comments on commit 2dc83bb

Please sign in to comment.