wvlet / airframe

Essential Building Blocks for Scala
https://wvlet.org/airframe
Apache License 2.0
631 stars 65 forks source link

airframe-http (js): Cross origin http://localhost forbidden error during testing #2905

Open xerial opened 1 year ago

xerial commented 1 year ago
Error: Cross origin http://localhost forbidden
    at dispatchError (/Users/leo/work/git/airframe/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:63:19)
    at Object.validCORSHeaders (/Users/leo/work/git/airframe/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:75:5)
    at receiveResponse (/Users/leo/work/git/airframe/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:794:19)
    at Request.<anonymous> (/Users/leo/work/git/airframe/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:658:43)
    at Request.emit (node:events:513:28)
    at Request._processResponse (/Users/leo/work/git/airframe/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:228:12)
    at ClientRequest.<anonymous> (/Users/leo/work/git/airframe/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:101:12)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:701:27) {
  type: 'XMLHttpRequest'
}
xerial commented 1 year ago

It looks like the http connection is forgetting about making requests from the Node jsdom environment while running sbt tests.

Using https://github.com/wvlet/airframe/issues/2897 may solve the issue. Slow response from httpbin is also related, so I removed tests using httpbin #2906