strongloop / strong-remoting

Communicate between objects in servers, mobile apps, and other servers.
www.strongloop.com
Other
105 stars 93 forks source link

Rest Adaper addRoute method does not forward route.http which removes the ability to specify a custom status #464

Closed tylkomat closed 5 years ago

tylkomat commented 5 years ago

Description/Steps to reproduce

Create a model with custom method:

Status.remoteMethod('getStatus', {
    description: 'shown response status code should be 201',
    http: {verb: 'post', path: '/status', status: 201},
  });

Link to reproduction sandbox

https://github.com/tylkomat/loopback-lost-status

Expected result

Api explorer and swagger.json should show the configured status code 201, but they show 204 which is the default value when no response is configured.

Additional information

The addRoute method of the rest adapter does not forward the http parameter of the route configuration. Which would be read by the swagger-spec-generator to configure the status code.

$ node -e 'console.log(process.platform, process.arch, process.versions.node)'
win32 x64 8.9.3
$ npm ls --prod --depth 0 | grep loopback
loopback-missing-status@1.0.0 C:\nodejs\loopback-missing-status
+-- loopback@3.25.1
+-- loopback-boot@2.28.0
+-- loopback-component-explorer@6.3.1
bajtos commented 5 years ago

Thank you @tylkomat for reporting the issue. Would you like to contribute the fix?

tylkomat commented 5 years ago

@bajtos sure