Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Docs for $http interceptor - what is the config object? #12949

Closed
adamzerner opened this issue Sep 25, 2015 · 5 comments
Closed

Docs for $http interceptor - what is the config object? #12949

adamzerner opened this issue Sep 25, 2015 · 5 comments

Comments

@adamzerner
Copy link
Contributor

The docs say that you have access to the config object, but don't say what the object looks like. It'd be helpful to know what the object looks like.

@pkozlowski-opensource
Copy link
Member

It is the same config object as documented in the "Usage" section of https://docs.angularjs.org/api/ng/service/$http

In other words - the same config that is used to trigger the original $http call that is being intercepted.

@adamzerner
Copy link
Contributor Author

I don't understand. It says:

The $http service is a function which takes a single argument — a configuration object — that is used to generate an HTTP request and returns a promise

But it doesn't document what this object looks like. Below, it gives examples using the shortcut methods $http.get and $http.post.

Edit: never mind, I see that it's documented below. So it's mentioned in the Usage section, but documented below. I still don't think it's clear that the config object mentioned is the Interceptors section refers to the same config object.

Edit 2: sorry, I confused the wording. It is in fact documented in the Usage section like you said (I confused Usage with General Usage). But I still think my point remains about it not being clear that the config objects are the same.

@gkalpak
Copy link
Member

gkalpak commented Sep 25, 2015

It's actually mentioned in the General Usage section (which might not be the best name), but document in the Usage section.
It might be a good idea to add a link to the Usage section on the phrase "configuration object" in:
"The $http service is a function which takes a single argument — a configuration object — that..."

@Narretz
Copy link
Contributor

Narretz commented Sep 25, 2015

The General Usage section itself doesn't show the config object very well, though, because it shows two examples with shortcuts.

@Narretz Narretz added this to the Backlog milestone Sep 25, 2015
Narretz added a commit to Narretz/angular.js that referenced this issue Sep 25, 2015
This makes it easier for beginners to find out what the config object looks like

Closes angular#12949
@Narretz
Copy link
Contributor

Narretz commented Sep 25, 2015

I have a PR here: #12950

Technically, it's almost impossible to miss the Usage section when reading the docs, it's simply that there's so much in there, and a beginner doesn't really know that the usage section comes at the end ..

Narretz added a commit that referenced this issue Sep 27, 2015
Linking to usage section makes it easier for beginners to find out what the config object looks like.
The General Usage section now features an example that actually uses $http(config), and the Shortcut Methods section has been moved so that it appears directly after.

Closes #12949
Closes #12950
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants