Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

Error: Parsing error: Unexpected token O in JSON at position 0 on PUT request #60

@eminx

Description

@eminx

Jo!

My PUT request works in the server - I get a 200 and positive results. But the http client I create has complains over my request and it actually throws an error.

Error: Parsing error : Unexpected token O in JSON at position 0

It seems to be an issue that originates from auto stringifying of JSON, but I can not find how to resolve...

My request looks like this:

        const dataObj = {name: 'my-new-name'}
        client.put('my-url', dataObj, (err, res, body) => {
  		if (err) {
  			this.snack.isOpen = true;
  			this.snack.message = "The operation couldn't be handled";
  			console.log('error!', err);
  		} else {
  			this.snack.isOpen = true;
  			this.snack.message = 'The virtualization is successfully updated';
  			console.log(res.statusCode);
  		}
	});

So what shall I do to make it work well?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions