Questions tagged [aurelia-fetch-client]

41 questions
1
vote
1 answer

How to configure aurelia-fetch-client withBaseUrl in CORS scenario?

I am running a REST server on http://localhost:8080, my Aurelia app on http://localhost:9000 and want to access the server with aurelia-fetch-client. I fail miserably already with the URL: For reasons I don't understand, the Aurelia host:port…
StaticNoiseLog
  • 1,370
  • 17
  • 27
1
vote
0 answers

Post FormData (key, value): controller not receiving value when string

The description for FormData.append() reads as follows: (method) FormData.append(name: string, value: string | Blob, fileName?: string):void The function below is simply just appending two string literals to a FormData object and posting it to a…
8protons
  • 3,591
  • 5
  • 32
  • 67
1
vote
1 answer

Fetch client having an issue with JSON array assignment

The Aurelia fetch client docs have a basic example of getting json data: bind() { let client = new HttpClient(); return client.fetch('data.json') .then(response => response.json()) .then(data => { …
8protons
  • 3,591
  • 5
  • 32
  • 67
1
vote
2 answers

How use responseError correctly with custom Aurelia http-fetch-client interceptors?

I'm working on an Aurelia CLI project, using TypeScript, and aurelia-fetch-client for making HTTP calls to a .NET Core / Web API backend. The server standardizes unhandled exceptions by returning an ApiError JSON result as the body of API responses,…
Sam
  • 6,167
  • 30
  • 39
1
vote
0 answers

Aurelia fetch client: 404 for POST with JSON body

I'm trying to post request with JSON body using aurelia fetch client. Here is my code: import {inject, NewInstance} from 'aurelia-framework'; import {HttpClient, json} from 'aurelia-fetch-client'; @inject(NewInstance.of(HttpClient)) export class…
sleb
  • 193
  • 1
  • 12
1
vote
2 answers

Aurelia Fetch Client - Unsupported Media Type - .NET Core WebAPI

When I try to post two parameters as JSON using Aurelia Fetch Client to a .NET Core WebAPI I get: 415 (Unsupported Media Type) ApplicationController [HttpPost("getapplications")] public ApplicationViewModel GetApplications([FromBody]…
Reft
  • 2,333
  • 5
  • 36
  • 64
1
vote
1 answer

Aurelia: How to handle a async request in a view?

I have a dotnet core api that returns a FileContentResult.. return new FileContentResult(bytes, contentType) { FileDownloadName = Path.GetFileName(request.Filename) }; Via postman I can read out the image perfectly fine. Now I want to read the…
Tom Aalbers
  • 4,574
  • 5
  • 29
  • 51
1
vote
1 answer

couchdb response with 400 status posting to _user db using aurelia fetch client

This is kind of strange. I make a rest post call to couchdb 2.0 to update the user database and I get back a 401 status message "error=bad_request" and "reason=Referer header must match host." However if I change the "post" to "put", then it is…
1
vote
1 answer

Aurelia support for XML

Will support be provided for XML file reads/writes? If I read the Aurelia docs correctly, Aurelia-fetch-client and aurelia-http-client, are configured for/expecting JSON response types (HTTP Services in Aurelia docs). I have a very large SPA…
RT1138
  • 183
  • 8
1
vote
2 answers

Aurelia fetch client TS2304: Cannot find name 'URLSearchParams'

After adding aurelia fetch client to my project i am getting the below exception when i am running au run /node_modules/aurelia-fetch-client/dist/aurelia-fetch-client.d.ts(73,43): error TS2304: Cannot find name 'URLSearchParams'. How to resolve…
Shravan Ramamurthy
  • 3,896
  • 5
  • 30
  • 44
1
vote
1 answer

TypeMismatchError on post

I'm writing an aurelia application with aurelia-fetch-client library. When I try to post an object to my api service I get the error: TypeMismatchError In console only from Edge. Other browsers (Chrome, Firefox and IE11) have no problems. There…
Federico Galfione
  • 1,069
  • 7
  • 19
1
vote
0 answers

Aurelia Fetch Client - Stop Chain on Interception

My global configuration in main.js: http.configure(config => { config .withInterceptor({ response(response) { if (response.status === 500) { toastr.error('Contact the tech guys.', 'Something has gone…
steamrolla
  • 2,373
  • 1
  • 29
  • 39
1
vote
2 answers

Get response headers from aurelia fetch-client

I have a method to return file from web api public static HttpResponseMessage FileAsFileAttachment(byte[] bytes, string filename) { var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(bytes) }; …
1
vote
0 answers

Aurelia: configure and use fetch in main.js

I have posted a question before on how to configure Aurelia's fetch client and use the configured client in all of my viewModels(Aurelia: configure fetch client) I configure my fetch client in my main.js file. Now i want to use this same configured…
Gilbert Nwaiwu
  • 687
  • 2
  • 13
  • 37
0
votes
1 answer

What is the correct way to setup CORS with ASP.NET Core and Aurelia (with http-fetch-client), with Windows authentication enabled?

Making a CORS request with ASP.NET Core and Aurelia http-fetch-client does not work correctly when Windows (NTLM) authentication is enabled. The setup is as follows: Static files are hosted on http://localhost:50927/ API is hosted on…
Joshun
  • 248
  • 1
  • 5
  • 11