1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I pass plain text as my request body using NestJS?

Discussion in 'Programming/Internet' started by luna, Sep 12, 2018.

  1. luna

    luna Guest

    One of the controller methods in my NestJS application is supposed to take plain text as its body but whenever I try to make a request, the parameter is received as an empty object. Is this even possible or am I going to have to create some sort of DTO to pass that single string?

    Example:

    @Post()
    myFunction(@Body() id: string) {
    // do something here
    }

    Login To add answer/comment
     

Share This Page