Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
415:c0589c3173fd | 417:aee3d7941c9b |
---|---|
15 } | 15 } |
16 //console.log(xhr); | 16 //console.log(xhr); |
17 xhr.onreadystatechange = function() { | 17 xhr.onreadystatechange = function() { |
18 if (this.readyState == XMLHttpRequest.DONE) { | 18 if (this.readyState == XMLHttpRequest.DONE) { |
19 if (xhr.status === 200) { | 19 if (xhr.status === 200) { |
20 var s = xhr.getAllResponseHeaders(); | |
21 var headers = _malloc(s.length + 1); | |
22 writeStringToMemory(s, headers); | |
23 | |
20 // TODO - Is "new Uint8Array()" necessary? This copies the | 24 // TODO - Is "new Uint8Array()" necessary? This copies the |
21 // answer to the WebAssembly stack, hence necessitating | 25 // answer to the WebAssembly stack, hence necessitating |
22 // increasing the TOTAL_STACK parameter of Emscripten | 26 // increasing the TOTAL_STACK parameter of Emscripten |
23 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | 27 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), |
24 this.response.byteLength, payload); | 28 this.response.byteLength, headers, payload); |
25 } else { | 29 } else { |
26 WasmWebService_NotifyError(callableFailure, url_, payload); | 30 WasmWebService_NotifyError(callableFailure, url_, payload); |
27 } | 31 } |
28 } | 32 } |
29 } | 33 } |
46 } | 50 } |
47 | 51 |
48 xhr.onreadystatechange = function() { | 52 xhr.onreadystatechange = function() { |
49 if (this.readyState == XMLHttpRequest.DONE) { | 53 if (this.readyState == XMLHttpRequest.DONE) { |
50 if (xhr.status === 200) { | 54 if (xhr.status === 200) { |
55 var s = xhr.getAllResponseHeaders(); | |
56 var headers = _malloc(s.length + 1); | |
57 writeStringToMemory(s, headers); | |
58 | |
51 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | 59 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), |
52 this.response.byteLength, payload); | 60 this.response.byteLength, headers, payload); |
53 } else { | 61 } else { |
54 WasmWebService_NotifyError(callableFailure, url_, payload); | 62 WasmWebService_NotifyError(callableFailure, url_, payload); |
55 } | 63 } |
56 } | 64 } |
57 } | 65 } |
74 } | 82 } |
75 | 83 |
76 xhr.onreadystatechange = function() { | 84 xhr.onreadystatechange = function() { |
77 if (this.readyState == XMLHttpRequest.DONE) { | 85 if (this.readyState == XMLHttpRequest.DONE) { |
78 if (xhr.status === 200) { | 86 if (xhr.status === 200) { |
87 var s = xhr.getAllResponseHeaders(); | |
88 var headers = _malloc(s.length + 1); | |
89 writeStringToMemory(s, headers); | |
90 | |
79 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | 91 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), |
80 this.response.byteLength, payload); | 92 this.response.byteLength, headers, payload); |
81 } else { | 93 } else { |
82 WasmWebService_NotifyError(callableFailure, url_, payload); | 94 WasmWebService_NotifyError(callableFailure, url_, payload); |
83 } | 95 } |
84 } | 96 } |
85 } | 97 } |