Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong api service generation #651

Open
4 tasks
RomainSanchez opened this issue Oct 28, 2019 · 0 comments
Open
4 tasks

Wrong api service generation #651

RomainSanchez opened this issue Oct 28, 2019 · 0 comments

Comments

@RomainSanchez
Copy link

What type of issue are you creating?

  • [ x] Bug
  • Enhancement
  • Question

What version of this module are you using?

  • 2.0.10 (Stable)
  • 2.1.0-rc.n (2.1 Release Candidate n)
  • [ x] 2.3.1

Hi when generating the service for a model, the typescript function does not post the request data.

here is my model remote method config:

"methods": {
    "upload": {
      "http": [
        {
          "path": "/upload",
          "verb": "post"
        }
      ],
      "accepts": [
        {
          "arg": "req",
          "type": "object",
          "required": true,
          "http": {
            "source": "req"
          },
          "description": "The http request"
        }
      ],
      "returns": [{
        "arg": "response",
        "type": "string",
          "required": true,
        "description": "The http response"
      }],
      "description": "Upload a file"
    }
  }

And here is the generated function :

 public upload(req: any, customHeaders?: Function): Observable<any> {
    let _method: string = "POST";
    let _url: string = LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() +
    "/Attachments/upload";
    let _routeParams: any = {};
    let _postBody: any = {};
    let _urlParams: any = {};
    let result = this.request(_method, _url, _routeParams, _urlParams, _postBody, null, customHeaders);
    return result;
  }

The _postBody is empty, the req parameter is not used.

In older versions it used to be let _postBody = {data: req}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant