I have a local webservice. If the webservice is queried via get request and doesn't have any content for the request, it responds with http 204 - No Content (and no content). For reference, if I'm using invoke-webrequest to access the service, I get this:
Code: Select all
Invoke-WebRequest -Uri $url
StatusCode : 204
StatusDescription : NoContent
Content : {}
RawContent : HTTP/1.1 204 NoContent
Date: Sat, 27 Jun 2020 08:21:37 GMT
Server: Kestrel
Content-Length: 0
Headers : {[Date, System.String[]], [Server, System.String[]], [Content-Length, System.String[]]}
RawContentLength : 0
RelationLink : {}
Code: Select all
let headers = newStringList();
headers.add('Content-Type: application/json');
try {
let response = await app.utils.web.getURLContentAsync(requestUrl, {
headers: headers
});
let parsedResponse = JSON.parse(response);
} catch (error) {
console.log('Error: ' + error.response)
}
Error: Access violation at address 0133566A in module 'MediaMonkeyEngine.exe'. Read of address 00000000
I was also able to reproduce this by using promises instead of async with some code I borrowed from lyricsSearch.js:
Code: Select all
var downloadPromise = app.utils.web.getURLContentAsync(requestUrl, {
headers: headers
});
downloadPromise.then(function (Content) {
console.log('succeeded ' + Content.response)
}, function (Content) {
console.log('failed ' + Content.response)
}).catch(err => {
console.log('err ' + err)
});
And the output I get:
Is there another way to handle these kind of requests, or is this intended behavior?failed Access violation at address 0133566A in module 'MediaMonkeyEngine.exe'. Read of address 00000000