question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

httpConfig arg for setFullRequestInterceptor is undocumented

See original GitHub issue

From the dox:

“It’s a function that receives the same as the requestInterceptor plus the headers and the query parameters (in that order).”

From the example in the “How to configure them globally” section:

RestangularProvider.setFullRequestInterceptor(function(element, operation, route, url, headers, params) {
      delete element.name;      
      return {
        element: element,
        params: _.extend(params, {single: true}),
        headers: headers
      };
    });

However, there’s a seventh argument to that function that must also be part of the returned object:

RestangularProvider.setFullRequestInterceptor(function(element, operation, route, url, headers, params, httpConfig) {
      delete element.name;      
      return {
        element: element,
        params: _.extend(params, {single: true}),
        headers: headers,
        httpConfig: httpConfig
      };
    });

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
flicuscommented, Jan 14, 2014

httpConfig is actually configuration object of Angular`s $http service, you can check it in the Angular documentation.

Object describing the request to be made and how it should be processed. The object has following properties:

    method – {string} – HTTP method (e.g. 'GET', 'POST', etc)
    url – {string} – Absolute or relative URL of the resource that is being requested.
    params – {Object.<string|Object>} – Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified.
    data – {string|Object} – Data to be sent as the request message data.
    headers – {Object} – Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent.
    xsrfHeaderName – {string} – Name of HTTP header to populate with the XSRF token.
    xsrfCookieName – {string} – Name of cookie containing the XSRF token.
    transformRequest – {function(data, headersGetter)|Array.<function(data, headersGetter)>} – transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version.
    transformResponse – {function(data, headersGetter)|Array.<function(data, headersGetter)>} – transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version.
    cache – {boolean|Cache} – If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
    timeout – {number|Promise} – timeout in milliseconds, or promise that should abort the request when resolved.
    withCredentials - {boolean} - whether to to set the withCredentials flag on the XHR object. See requests with credentials for more information.
    responseType - {string} - see requestType.


0reactions
mgontocommented, Jan 14, 2014

Great.

I’ll update documentation then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restangular Sample, rewritten to work with nge2e
setFullRequestInterceptor = function(interceptor) { config. ... httpConfig] = undefined; return RestangularResource(this.config, $http, url, ...
Read more >
https://softwarepublico.gov.br/gitlab/noosfero-the...
... context?: any): any; + + fromJson(json: string): any; + identity<T>(arg?: ... + // BrowserService + // TODO undocumented, so we need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found