I'm using rest.js
from npm install rest
and cannot get my params to append to the path in the request. Here is my client.js
'use strict';
var rest = require('rest');
var defaultRequest = require('rest/interceptor/defaultRequest');
var mime = require('rest/interceptor/mime');
var uriTemplateInterceptor = require('rest/interceptor/template');
var errorCode = require('rest/interceptor/errorCode');
var baseRegistry = require('rest/mime/registry');
var registry = baseRegistry.child();
registry.register('text/uri-list', require('./api/uriListConverter'));
registry.register('application/hal+json', require('rest/mime/type/application/hal'));
module.exports = rest
.wrap(mime, { registry: registry })
.wrap(uriTemplateInterceptor)
.wrap(errorCode)
.wrap(defaultRequest, { headers: { 'Accept': 'application/hal+json' }});
I used the template interceptor suggested here https://github.com/cujojs/rest/blob/master/docs/interceptors.md#module-rest/interceptor/template. Here is my code making the request:
client({method: 'GET', path: 'api/questions/page', params: {offset: 0, limit:10}})
.then(response => console.log(response.request.path));
The output of the console.log(response.request.path)
is api/questions/page and it also doesn't show the request params in the network log. How do I get the params to append to the path?