diff Platforms/Wasm/WasmWebService.js @ 417:aee3d7941c9b

preparing to load images using DICOMweb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Nov 2018 17:28:15 +0100
parents aad37d0b6407
children d638d5721f1c
line wrap: on
line diff
--- a/Platforms/Wasm/WasmWebService.js	Tue Nov 13 10:36:53 2018 +0100
+++ b/Platforms/Wasm/WasmWebService.js	Thu Nov 15 17:28:15 2018 +0100
@@ -17,11 +17,15 @@
     xhr.onreadystatechange = function() {
       if (this.readyState == XMLHttpRequest.DONE) {
         if (xhr.status === 200) {
+          var s = xhr.getAllResponseHeaders();
+          var headers = _malloc(s.length + 1);
+          writeStringToMemory(s, headers);
+          
           // TODO - Is "new Uint8Array()" necessary? This copies the
           // answer to the WebAssembly stack, hence necessitating
           // increasing the TOTAL_STACK parameter of Emscripten
           WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response),
-                                       this.response.byteLength, payload);
+                                       this.response.byteLength, headers, payload);
         } else {
           WasmWebService_NotifyError(callableFailure, url_, payload);
         }
@@ -48,8 +52,12 @@
     xhr.onreadystatechange = function() {
       if (this.readyState == XMLHttpRequest.DONE) {
         if (xhr.status === 200) {
+          var s = xhr.getAllResponseHeaders();
+          var headers = _malloc(s.length + 1);
+          writeStringToMemory(s, headers);
+
           WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response),
-                                       this.response.byteLength, payload);
+                                       this.response.byteLength, headers, payload);
         } else {
           WasmWebService_NotifyError(callableFailure, url_, payload);
         }
@@ -76,8 +84,12 @@
     xhr.onreadystatechange = function() {
       if (this.readyState == XMLHttpRequest.DONE) {
         if (xhr.status === 200) {
+          var s = xhr.getAllResponseHeaders();
+          var headers = _malloc(s.length + 1);
+          writeStringToMemory(s, headers);
+
           WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response),
-                                       this.response.byteLength, payload);
+                                       this.response.byteLength, headers, payload);
         } else {
           WasmWebService_NotifyError(callableFailure, url_, payload);
         }