I am sure my angular client is not correct, but I am also pretty sure I shouldn’t be getting a 500 before getting to the service handler. The 500 does not occur if I remove the headers. This is a CORS btw.
DTO/Service Stub
[Route("/app-product/upload/{AmazonAccountId}")]
public class Upload
{
public string AmazonAccountId { get; set; }
}
public object Post(Upload request)
{ // doesn't get here...
var foo = "";
type script client:
postFile() {
console.log("uploading " + this.fileToUpload.name)
this.http.post(this.baseUrl +"app-product/upload/" + this.selectedAccount, this.fileToUpload ,
{ headers: {'filename': this.fileToUpload.name, 'Content-Type': 'multipart/form-data'},
withCredentials: true, reportProgress: true}).subscribe(
);
}
Response:
Request URL: https://localhost:8443/app-product/upload/40988
Request Method: POST
Status Code: 500 Internal Server Error
Remote Address: 127.0.0.1:8443
Referrer Policy: no-referrer-when-downgrade
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type,enctype,filename
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin: http://localhost:4200
Content-Type: application/json; charset=utf-8
Date: Sat, 27 Oct 2018 14:12:22 GMT
Server: Kestrel
Transfer-Encoding: chunked
Vary: Accept
X-Powered-By: ServiceStack/5.20 NetCore/OSX
Provisional headers are shown
Accept: application/json, text/plain, /
Content-Type: multipart/form-data
DNT: 1
filename: Download.csv
Origin: http://localhost:4200
Referer: http://localhost:4200/upload
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36