How do I solve ok: false response with Angular 5 and .NET Core?











up vote
-1
down vote

favorite












There is simple method returning Ok:



[HttpGet("request_name")]
public IActionResult request_name()
{
using (var db = new WordContext())
{
return Ok("This is ok response string");
}
}


And simple request in ngx:



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`);
}.subscribe(x => {

});


I can see code 200 "This is ok response string" in chrome, but there is error message in chrome console:




ERROR HttpErrorResponse {headers: HttpHeaders, status: 200,
statusText: "OK", url:
"http://localhost:4200/main/name/request_name", ok: false, …}




What does it mean and how do I solve it?






Updated




The error message:



error:
error: SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31) at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34) at invokeTask (http://localhost:5010/polyfills.js:3862:14) at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)
message: "Unexpected token T in JSON at position 0"
stack: "SyntaxError: Unexpected token T in JSON at position 0↵ at JSON.parse (<anonymous>)↵ at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31)↵ at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36)↵ at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47)↵ at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34)↵ at invokeTask (http://localhost:5010/polyfills.js:3862:14)↵ at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)"
__proto__: Error
text: "This is ok response string"
__proto__: Object
headers: HttpHeaders
lazyInit: ƒ ()
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure during parsing for http://localhost:5005/main/word/request_name"
name: "HttpErrorResponse"
ok: false
status: 200
statusText: "OK"
url: "http://localhost:5005/main/word/request_name"









share|improve this question
























  • what is the complete error log?
    – Jota.Toledo
    Nov 10 at 19:52










  • @Jota.Toledo defaultErrorLogger @ core.js:1673 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 next @ core.js:4311 schedulerFn @ core.js:3551 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54 and so on
    – mr_blond
    Nov 10 at 20:08










  • Not the stack trace. I mean, you got ERROR: HttpErrorResponse ..., which are the details of an error object. Could you update your question with the complete object details?
    – Jota.Toledo
    Nov 10 at 20:12












  • Ah, I see. I've added details to question.
    – mr_blond
    Nov 10 at 20:29










  • The error instance is clear, the HttpClient tries to parse an invalid JSON string. See angular.io/guide/http#requesting-non-json-data
    – Jota.Toledo
    Nov 10 at 20:33

















up vote
-1
down vote

favorite












There is simple method returning Ok:



[HttpGet("request_name")]
public IActionResult request_name()
{
using (var db = new WordContext())
{
return Ok("This is ok response string");
}
}


And simple request in ngx:



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`);
}.subscribe(x => {

});


I can see code 200 "This is ok response string" in chrome, but there is error message in chrome console:




ERROR HttpErrorResponse {headers: HttpHeaders, status: 200,
statusText: "OK", url:
"http://localhost:4200/main/name/request_name", ok: false, …}




What does it mean and how do I solve it?






Updated




The error message:



error:
error: SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31) at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34) at invokeTask (http://localhost:5010/polyfills.js:3862:14) at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)
message: "Unexpected token T in JSON at position 0"
stack: "SyntaxError: Unexpected token T in JSON at position 0↵ at JSON.parse (<anonymous>)↵ at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31)↵ at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36)↵ at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47)↵ at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34)↵ at invokeTask (http://localhost:5010/polyfills.js:3862:14)↵ at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)"
__proto__: Error
text: "This is ok response string"
__proto__: Object
headers: HttpHeaders
lazyInit: ƒ ()
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure during parsing for http://localhost:5005/main/word/request_name"
name: "HttpErrorResponse"
ok: false
status: 200
statusText: "OK"
url: "http://localhost:5005/main/word/request_name"









share|improve this question
























  • what is the complete error log?
    – Jota.Toledo
    Nov 10 at 19:52










  • @Jota.Toledo defaultErrorLogger @ core.js:1673 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 next @ core.js:4311 schedulerFn @ core.js:3551 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54 and so on
    – mr_blond
    Nov 10 at 20:08










  • Not the stack trace. I mean, you got ERROR: HttpErrorResponse ..., which are the details of an error object. Could you update your question with the complete object details?
    – Jota.Toledo
    Nov 10 at 20:12












  • Ah, I see. I've added details to question.
    – mr_blond
    Nov 10 at 20:29










  • The error instance is clear, the HttpClient tries to parse an invalid JSON string. See angular.io/guide/http#requesting-non-json-data
    – Jota.Toledo
    Nov 10 at 20:33















up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











There is simple method returning Ok:



[HttpGet("request_name")]
public IActionResult request_name()
{
using (var db = new WordContext())
{
return Ok("This is ok response string");
}
}


And simple request in ngx:



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`);
}.subscribe(x => {

});


I can see code 200 "This is ok response string" in chrome, but there is error message in chrome console:




ERROR HttpErrorResponse {headers: HttpHeaders, status: 200,
statusText: "OK", url:
"http://localhost:4200/main/name/request_name", ok: false, …}




What does it mean and how do I solve it?






Updated




The error message:



error:
error: SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31) at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34) at invokeTask (http://localhost:5010/polyfills.js:3862:14) at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)
message: "Unexpected token T in JSON at position 0"
stack: "SyntaxError: Unexpected token T in JSON at position 0↵ at JSON.parse (<anonymous>)↵ at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31)↵ at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36)↵ at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47)↵ at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34)↵ at invokeTask (http://localhost:5010/polyfills.js:3862:14)↵ at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)"
__proto__: Error
text: "This is ok response string"
__proto__: Object
headers: HttpHeaders
lazyInit: ƒ ()
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure during parsing for http://localhost:5005/main/word/request_name"
name: "HttpErrorResponse"
ok: false
status: 200
statusText: "OK"
url: "http://localhost:5005/main/word/request_name"









share|improve this question















There is simple method returning Ok:



[HttpGet("request_name")]
public IActionResult request_name()
{
using (var db = new WordContext())
{
return Ok("This is ok response string");
}
}


And simple request in ngx:



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`);
}.subscribe(x => {

});


I can see code 200 "This is ok response string" in chrome, but there is error message in chrome console:




ERROR HttpErrorResponse {headers: HttpHeaders, status: 200,
statusText: "OK", url:
"http://localhost:4200/main/name/request_name", ok: false, …}




What does it mean and how do I solve it?






Updated




The error message:



error:
error: SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31) at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34) at invokeTask (http://localhost:5010/polyfills.js:3862:14) at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)
message: "Unexpected token T in JSON at position 0"
stack: "SyntaxError: Unexpected token T in JSON at position 0↵ at JSON.parse (<anonymous>)↵ at XMLHttpRequest.onLoad (http://localhost:5010/vendor.js:7457:51)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2743:31)↵ at Object.onInvokeTask (http://localhost:5010/vendor.js:36915:33)↵ at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:5010/polyfills.js:2742:36)↵ at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:5010/polyfills.js:2510:47)↵ at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:5010/polyfills.js:2818:34)↵ at invokeTask (http://localhost:5010/polyfills.js:3862:14)↵ at XMLHttpRequest.globalZoneAwareCallback (http://localhost:5010/polyfills.js:3888:17)"
__proto__: Error
text: "This is ok response string"
__proto__: Object
headers: HttpHeaders
lazyInit: ƒ ()
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure during parsing for http://localhost:5005/main/word/request_name"
name: "HttpErrorResponse"
ok: false
status: 200
statusText: "OK"
url: "http://localhost:5005/main/word/request_name"






c# angular .net-core httprequest httpresponse






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 20:26

























asked Nov 10 at 19:23









mr_blond

13711




13711












  • what is the complete error log?
    – Jota.Toledo
    Nov 10 at 19:52










  • @Jota.Toledo defaultErrorLogger @ core.js:1673 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 next @ core.js:4311 schedulerFn @ core.js:3551 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54 and so on
    – mr_blond
    Nov 10 at 20:08










  • Not the stack trace. I mean, you got ERROR: HttpErrorResponse ..., which are the details of an error object. Could you update your question with the complete object details?
    – Jota.Toledo
    Nov 10 at 20:12












  • Ah, I see. I've added details to question.
    – mr_blond
    Nov 10 at 20:29










  • The error instance is clear, the HttpClient tries to parse an invalid JSON string. See angular.io/guide/http#requesting-non-json-data
    – Jota.Toledo
    Nov 10 at 20:33




















  • what is the complete error log?
    – Jota.Toledo
    Nov 10 at 19:52










  • @Jota.Toledo defaultErrorLogger @ core.js:1673 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 next @ core.js:4311 schedulerFn @ core.js:3551 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54 and so on
    – mr_blond
    Nov 10 at 20:08










  • Not the stack trace. I mean, you got ERROR: HttpErrorResponse ..., which are the details of an error object. Could you update your question with the complete object details?
    – Jota.Toledo
    Nov 10 at 20:12












  • Ah, I see. I've added details to question.
    – mr_blond
    Nov 10 at 20:29










  • The error instance is clear, the HttpClient tries to parse an invalid JSON string. See angular.io/guide/http#requesting-non-json-data
    – Jota.Toledo
    Nov 10 at 20:33


















what is the complete error log?
– Jota.Toledo
Nov 10 at 19:52




what is the complete error log?
– Jota.Toledo
Nov 10 at 19:52












@Jota.Toledo defaultErrorLogger @ core.js:1673 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 next @ core.js:4311 schedulerFn @ core.js:3551 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54 and so on
– mr_blond
Nov 10 at 20:08




@Jota.Toledo defaultErrorLogger @ core.js:1673 push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:1719 next @ core.js:4311 schedulerFn @ core.js:3551 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:196 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:134 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:77 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:54 and so on
– mr_blond
Nov 10 at 20:08












Not the stack trace. I mean, you got ERROR: HttpErrorResponse ..., which are the details of an error object. Could you update your question with the complete object details?
– Jota.Toledo
Nov 10 at 20:12






Not the stack trace. I mean, you got ERROR: HttpErrorResponse ..., which are the details of an error object. Could you update your question with the complete object details?
– Jota.Toledo
Nov 10 at 20:12














Ah, I see. I've added details to question.
– mr_blond
Nov 10 at 20:29




Ah, I see. I've added details to question.
– mr_blond
Nov 10 at 20:29












The error instance is clear, the HttpClient tries to parse an invalid JSON string. See angular.io/guide/http#requesting-non-json-data
– Jota.Toledo
Nov 10 at 20:33






The error instance is clear, the HttpClient tries to parse an invalid JSON string. See angular.io/guide/http#requesting-non-json-data
– Jota.Toledo
Nov 10 at 20:33














1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










If your response type is not a JSON it will just pass the response to the error



Try something like this



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.subscribe(x => {

});


Whereas don't use subscribe use pipe operator and tap to read the response - hope i think you are using HttpClient in angular



    return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.pipe(tap(res => {
console.log(res);
}));





share|improve this answer























  • you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
    – Eliseo
    Nov 10 at 20:15










  • To cutoff the request i just told map changed as per you said - Thanks
    – Rahul Swamynathan
    Nov 11 at 2:12











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242601%2fhow-do-i-solve-ok-false-response-with-angular-5-and-net-core%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










If your response type is not a JSON it will just pass the response to the error



Try something like this



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.subscribe(x => {

});


Whereas don't use subscribe use pipe operator and tap to read the response - hope i think you are using HttpClient in angular



    return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.pipe(tap(res => {
console.log(res);
}));





share|improve this answer























  • you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
    – Eliseo
    Nov 10 at 20:15










  • To cutoff the request i just told map changed as per you said - Thanks
    – Rahul Swamynathan
    Nov 11 at 2:12















up vote
0
down vote



accepted










If your response type is not a JSON it will just pass the response to the error



Try something like this



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.subscribe(x => {

});


Whereas don't use subscribe use pipe operator and tap to read the response - hope i think you are using HttpClient in angular



    return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.pipe(tap(res => {
console.log(res);
}));





share|improve this answer























  • you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
    – Eliseo
    Nov 10 at 20:15










  • To cutoff the request i just told map changed as per you said - Thanks
    – Rahul Swamynathan
    Nov 11 at 2:12













up vote
0
down vote



accepted







up vote
0
down vote



accepted






If your response type is not a JSON it will just pass the response to the error



Try something like this



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.subscribe(x => {

});


Whereas don't use subscribe use pipe operator and tap to read the response - hope i think you are using HttpClient in angular



    return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.pipe(tap(res => {
console.log(res);
}));





share|improve this answer














If your response type is not a JSON it will just pass the response to the error



Try something like this



request_name() {
return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.subscribe(x => {

});


Whereas don't use subscribe use pipe operator and tap to read the response - hope i think you are using HttpClient in angular



    return this.http
.get<string>(`${this.apiUrl}/request_name`, {responseType: 'text'});
}.pipe(tap(res => {
console.log(res);
}));






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 11 at 2:11

























answered Nov 10 at 19:27









Rahul Swamynathan

8861314




8861314












  • you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
    – Eliseo
    Nov 10 at 20:15










  • To cutoff the request i just told map changed as per you said - Thanks
    – Rahul Swamynathan
    Nov 11 at 2:12


















  • you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
    – Eliseo
    Nov 10 at 20:15










  • To cutoff the request i just told map changed as per you said - Thanks
    – Rahul Swamynathan
    Nov 11 at 2:12
















you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
– Eliseo
Nov 10 at 20:15




you needn't .pipe(map(res=>{...}). map is for change the response, if you want to check the value use pipe(tap(res=>{...})
– Eliseo
Nov 10 at 20:15












To cutoff the request i just told map changed as per you said - Thanks
– Rahul Swamynathan
Nov 11 at 2:12




To cutoff the request i just told map changed as per you said - Thanks
– Rahul Swamynathan
Nov 11 at 2:12


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242601%2fhow-do-i-solve-ok-false-response-with-angular-5-and-net-core%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?