How to pass 3 argument to backend with `POST` request?Angular (5) httpclient observe and responseType: 'blob'How to send post request with only 1 argument in Angular?Angular 6: Updating POST request from Http to HttpClientHow can I get both body and headers from http request in angular 7Angular 7 HttpClient post response headers are emptyAngular 7 HttpClient post 404Angular 7: Post request always send a null bodyNot able to fetch data from backend got 404Post data to API with or without subscribeAngular - Cancel prior HTTP request if a later request fails
UK - Working without a contract. I resign and guy wants to sue me
Is it possible to get a mortgage with a custom duration in the US?
What is the highest voltage from the power supply a Raspberry Pi 3 B can handle without getting damaged?
Why does the Saturn V have standalone inter-stage rings?
Is there any proof that high saturation and contrast makes a picture more appealing in social media?
How does DC work with natural 20?
How do I professionally let my manager know I'll quit over an issue?
When to remove insignificant variables?
Helping ease my back pain by studying 13 hours everyday , even weekends
Why is it easier to balance a non-moving bike standing up than sitting down?
Greeting with "Ho"
Do I need a shock-proof watch for cycling?
What's currently blocking the construction of the wall between Mexico and the US?
Should an enameled cast iron pan be seasoned?
Cut the gold chain
Confusion over 220 and 230 volt outlets
Why do all the teams that I have worked with always finish a sprint without completion of all the stories?
RandomInteger with equal number of 1 and -1
Heavily limited premature compiler translates text into excecutable python code
How does a blind passenger not die, if driver becomes unconscious
What are Elsa's reasons for selecting the Holy Grail on behalf of Donovan?
How did Gollum enter Moria?
Designing a magic-compatible polearm
Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?
How to pass 3 argument to backend with `POST` request?
Angular (5) httpclient observe and responseType: 'blob'How to send post request with only 1 argument in Angular?Angular 6: Updating POST request from Http to HttpClientHow can I get both body and headers from http request in angular 7Angular 7 HttpClient post response headers are emptyAngular 7 HttpClient post 404Angular 7: Post request always send a null bodyNot able to fetch data from backend got 404Post data to API with or without subscribeAngular - Cancel prior HTTP request if a later request fails
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
According to backend, I require to pass 3 argument through post request, this backend function is:
public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload)
now I am trying to pass the argument like this:
uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam>
const fileName = uploadData.fileName;
console.log('file name is', fileName);
const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
But getting error, not able to pass 3 arguments at all. what is the correct way to do this?
any one help me?
angular7 angular-httpclient
add a comment |
According to backend, I require to pass 3 argument through post request, this backend function is:
public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload)
now I am trying to pass the argument like this:
uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam>
const fileName = uploadData.fileName;
console.log('file name is', fileName);
const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
But getting error, not able to pass 3 arguments at all. what is the correct way to do this?
any one help me?
angular7 angular-httpclient
add a comment |
According to backend, I require to pass 3 argument through post request, this backend function is:
public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload)
now I am trying to pass the argument like this:
uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam>
const fileName = uploadData.fileName;
console.log('file name is', fileName);
const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
But getting error, not able to pass 3 arguments at all. what is the correct way to do this?
any one help me?
angular7 angular-httpclient
According to backend, I require to pass 3 argument through post request, this backend function is:
public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload)
now I am trying to pass the argument like this:
uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam>
const fileName = uploadData.fileName;
console.log('file name is', fileName);
const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
But getting error, not able to pass 3 arguments at all. what is the correct way to do this?
any one help me?
angular7 angular-httpclient
angular7 angular-httpclient
asked Mar 25 at 7:25
3gwebtrain3gwebtrain
5,7981769150
5,7981769150
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I will suggest wrapping all in a single object. And send it to backend.
Or just send uploadData
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
And in the backend, you can get uploadDate like req.body.uploadData
To check you can console.log(uploadData.fileName);
add a comment |
its my working example
this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());
Where client is customer object and this.getHeaders() is:
getHeaders()
return
headers: new HttpHeaders(
'Content-Type': 'application/json; charset=utf-8',
)
;
Good luck!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332958%2fhow-to-pass-3-argument-to-backend-with-post-request%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I will suggest wrapping all in a single object. And send it to backend.
Or just send uploadData
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
And in the backend, you can get uploadDate like req.body.uploadData
To check you can console.log(uploadData.fileName);
add a comment |
I will suggest wrapping all in a single object. And send it to backend.
Or just send uploadData
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
And in the backend, you can get uploadDate like req.body.uploadData
To check you can console.log(uploadData.fileName);
add a comment |
I will suggest wrapping all in a single object. And send it to backend.
Or just send uploadData
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
And in the backend, you can get uploadDate like req.body.uploadData
To check you can console.log(uploadData.fileName);
I will suggest wrapping all in a single object. And send it to backend.
Or just send uploadData
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)
And in the backend, you can get uploadDate like req.body.uploadData
To check you can console.log(uploadData.fileName);
answered Mar 26 at 5:12
AshishAshish
541111
541111
add a comment |
add a comment |
its my working example
this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());
Where client is customer object and this.getHeaders() is:
getHeaders()
return
headers: new HttpHeaders(
'Content-Type': 'application/json; charset=utf-8',
)
;
Good luck!
add a comment |
its my working example
this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());
Where client is customer object and this.getHeaders() is:
getHeaders()
return
headers: new HttpHeaders(
'Content-Type': 'application/json; charset=utf-8',
)
;
Good luck!
add a comment |
its my working example
this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());
Where client is customer object and this.getHeaders() is:
getHeaders()
return
headers: new HttpHeaders(
'Content-Type': 'application/json; charset=utf-8',
)
;
Good luck!
its my working example
this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());
Where client is customer object and this.getHeaders() is:
getHeaders()
return
headers: new HttpHeaders(
'Content-Type': 'application/json; charset=utf-8',
)
;
Good luck!
answered Mar 25 at 8:08
user3804427user3804427
1396
1396
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332958%2fhow-to-pass-3-argument-to-backend-with-post-request%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown