aurelia-fetch-client

How to download a ZipFile from a dotnet core webapi?

不羁岁月 提交于 2019-12-20 04:34:11
问题 I am trying to download a zip file from a dotnet core web api action, but I can't make it work. I tried calling the action via POSTMAN and my Aurelia Http Fetch Client. I am able to create the ZipFile like I want it and store it on the system, but can't fix it so it returns the zipfile via the api. Use-case: User selects a couple of picture collections and clicks the download button. The ids of the picture collections gets send to the api and a zipfile is created which contains a directory

CORS errors on Azure Translator API (Cognitive Services) when using Aurelia's Fetch Client

大兔子大兔子 提交于 2019-12-13 16:23:03
问题 I try to use a very basic API call from Windows Azure to translate some texts. They gives a quickstart example code. I try this code and it works pretty well. The text Hello world is translated into deutch and italian. I removed my personal subscription key. Here is the sample: const request = require('request'); const uuidv4 = require('uuid/v4'); const subscriptionKey = '........'; let options = { method: 'POST', baseUrl: 'https://api.cognitive.microsofttranslator.com/', url: 'translate', qs

Error handling for fetch() in Aurelia

不羁岁月 提交于 2019-12-03 05:54:34
问题 I have an API that includes a useful description of what went wrong when an error is raised by the server (status = 500). The description comes as part of the response text. My client code, using Aurelia, calls the api via aurelia-fetch-client using a generic method to make the call: function callRemoteService(apiName, timeout) { return Promise.race([ this.http.fetch(apiName), this.waitForServer(timeout || 5000) // throws after x ms ]) .then(response => response.json() ) .catch(err => { if

Error handling for fetch() in Aurelia

99封情书 提交于 2019-12-02 19:17:36
I have an API that includes a useful description of what went wrong when an error is raised by the server (status = 500). The description comes as part of the response text. My client code, using Aurelia, calls the api via aurelia-fetch-client using a generic method to make the call: function callRemoteService(apiName, timeout) { return Promise.race([ this.http.fetch(apiName), this.waitForServer(timeout || 5000) // throws after x ms ]) .then(response => response.json() ) .catch(err => { if (err instanceof Response) { // HERE'S THE PROBLEM..... err.text().then(text => { console.log('Error text

How to download a ZipFile from a dotnet core webapi?

旧巷老猫 提交于 2019-12-02 05:33:57
I am trying to download a zip file from a dotnet core web api action, but I can't make it work. I tried calling the action via POSTMAN and my Aurelia Http Fetch Client. I am able to create the ZipFile like I want it and store it on the system, but can't fix it so it returns the zipfile via the api. Use-case: User selects a couple of picture collections and clicks the download button. The ids of the picture collections gets send to the api and a zipfile is created which contains a directory for every picture collection which holds the pictures. That zipfile is returned to the user so he/she can