Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose the hypermedia headers in response #226

Merged
merged 1 commit into from
Oct 7, 2014
Merged

expose the hypermedia headers in response #226

merged 1 commit into from
Oct 7, 2014

Conversation

volkanunsal
Copy link
Contributor

No description provided.

@monfresh
Copy link
Member

monfresh commented Sep 8, 2014

Thanks. Per our contribution guidelines, could you please add/update the specs for this feature?

Also, please provide a detailed commit message explaining what issue this is addressing and why it's important.

Finally, I would only include Link and X-Total-Count. The others will be removed since they are not used. Eventually, I think I might remove the X-Total-Count header and put that information in the JSON instead, like the GitHub API does it.

@monfresh
Copy link
Member

monfresh commented Sep 8, 2014

Also, could you please rebase against master to pick up the Travis fix I just pushed? That way, your PR can run on Travis.

@monfresh
Copy link
Member

monfresh commented Sep 9, 2014

If you haven't already picked up the Travis change, it might be easier to just update the Ruby version in your .travis.yml to 2.1.2 because I just pushed another change to master which will require you to run some migrations. Since this PR does not depend on the DB change I just pushed, it's probably simpler to just update the Travis file directly in this PR.

@volkanunsal
Copy link
Contributor Author

Oh I haven't had time to do this yet. I will get on it today.

@volkanunsal
Copy link
Contributor Author

Is the format of the Link header a standard? I'm scratching my head to figure out how to parse it. It's not like anything I've seen before.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling c1602b4 on volkanunsal:patch-1 into f624ded on codeforamerica:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling c1602b4 on volkanunsal:patch-1 into f624ded on codeforamerica:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling f109892 on volkanunsal:patch-1 into f624ded on codeforamerica:master.

@monfresh
Copy link
Member

Yes it is. Are you asking about the parsing in general or related to this PR? You shouldn't need to parse it in this PR.

If you're trying to parse it for use in an app, you can use our Ruby wrapper, and access the Link data like this:

locations = Ohanakapa.locations
locations.concat Ohanakapa.last_response.rels[:next].get.data

Our Ruby wrapper is pretty much Octokit.rb, but I need to add a Pagination section to our README.

While testing this just now, I found a bug. It seems like the Link header is not returned when SSL is turned on.

@volkanunsal
Copy link
Contributor Author

Not related to this PR. I tried accessing Links from the browser and had to write my own parser is JS. The format is really strange. I can't say how they came up with it, but I'd appreciate it much more if it just gave me a link I could drop on the page and not this:

<http:localhost:3000/xyz?abc=123> rel='next'; <http:localhost:3000/xyz?abc=124> rel='last';

@monfresh
Copy link
Member

Getting back to this PR, could you please make the following changes:

  1. Update the description of the updated specs to match the expected outcome. For example, it 'exposes the Link and X-Total-Count headers'.
  2. Use single quotes instead of double quotes per the Ruby Style Guide that we follow (see our contribution guidelines).
  3. Run script/test to make sure all tests pass and that no Style Guide offenses are present.
  4. Once everything passes, please rebase your commits into one commit.

Thanks!

In order to access headers in a browser, we need to expose them as per
CORS protocol.

Fix the spec name
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 1566df5 on volkanunsal:patch-1 into 1ad8731 on codeforamerica:master.

@volkanunsal
Copy link
Contributor Author

Ok, done.

monfresh added a commit that referenced this pull request Oct 7, 2014
expose the hypermedia headers in response when using CORS
@monfresh monfresh merged commit 5b72e04 into codeforamerica:master Oct 7, 2014
@monfresh
Copy link
Member

monfresh commented Oct 7, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants