Skip to content

method to intercept request to rewrite request url #603

@airtonix

Description

@airtonix

This is a question about addRequestInterceptor.

Despite having access to the initial request URL (that is created by the URL builder), it doesn't seem to allow me to change the URL that ends up being used, I could be wrong.

My use case is this :

  • My data is stored as static JSON files on github pages.
  • I use angular
  • I'm building a resource that pulls collections or a single item based on a reference like api/recipe/453

I'd like to transform the request url on the .one(453) from api/recipe/453/data.json to merely api/recipe/data.json then pull out the item with id matching 453 using some lodash.

I feel that addRequestInterceptor meets all but one of those needs (that of rewriting the eventual url used).

Can you clarify if addRequestInterceptor makes it possible to do the following:

  • change the URL used to make the request
  • manipulate the data retrieved with something like lodash
  • use cached data instead of making http requests.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions