소스 검색

Merge pull request #6056 from Stoehr-Sauer/FIX_WebRequest_CustomRequestHeaders

Fix web request custom request headers
David Catuhe 6 년 전
부모
커밋
303580193d
2개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 0
      dist/preview release/what's new.md
  2. 4 4
      src/Misc/webRequest.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -232,6 +232,7 @@
 - PointerDragBehavior validateDrag predicate to stop dragging to specific points ([TrevorDev](https://github.com/TrevorDev))
 - Auto Update Touch Action [#5674](https://github.com/BabylonJS/Babylon.js/issues/5674)([Sebavan](https://github.com/Sebavan))
 - Add hemispheric lighting to gizmos to avoid flat look ([TrevorDev](https://github.com/TrevorDev))
+- Fix a bug causing `WebRequest.open` to crash if `WebRequest.CustomRequestHeaders` are set [#6055](https://github.com/BabylonJS/Babylon.js/issues/6055)([susares](https://github.com/susares))
 
 ### Viewer
 

+ 4 - 4
src/Misc/webRequest.ts

@@ -112,6 +112,10 @@ export class WebRequest {
      * @param body defines an optional request body
      */
     public send(body?: Document | BodyInit | null): void {
+        if (WebRequest.CustomRequestHeaders) {
+            this._injectCustomRequestHeaders();
+        }
+
         this._xhr.send(body);
     }
 
@@ -121,10 +125,6 @@ export class WebRequest {
      * @param url defines the url to connect with
      */
     public open(method: string, url: string): void {
-        if (WebRequest.CustomRequestHeaders) {
-            this._injectCustomRequestHeaders();
-        }
-
         for (var update of WebRequest.CustomRequestModifiers) {
             update(this._xhr);
         }