0
post<T>(url: string, body: any): Observable<T> { 
    return this.http.post<T>(this.baseUrl + decodeURIComponent(url), body);
}

add(data){
    return this.commonHttpService.post(`/organisations​/add`,data);
}

onSubmit() {
    const controls = this.addForm.controls;
    const data = {
        name: controls.value
    };
    this.homeService
    .add(data)
    .pipe(catchError(err => of(err)
    ), tap((resp: any) => {
    if (resp.status_code === 200) {
        Swal.fire('Ensemble added successfully!', '', 'success') }

Request URL I recieved- http://X.XXX.XXX.XXX/api/organisations%E2%80%8B/add

Expected Request URL- http://X.XXX.XXX.XXX/api/organisations/add

I added the decodeURIComponent to the url but still I am getting this request url. How can we solve this? Tried many ways.

2
  • Create custom function. Commented Dec 31, 2020 at 6:59
  • Have you tried with ActivatedRoute? ActivatedRoute have an url property that return an UrlSegment[] Observable Commented Dec 31, 2020 at 8:31

1 Answer 1

1

You must be out of luck. I copy/paste your code in the javascript console and it showed me an invisible character.

The code constains an invisible dot between organistations and "/add"

Try to rewrite your code by hand

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot man. I have been on it for hours. You saved me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.