Shouldn't GetArchiveLink accept 301 redirections? #1248
Comments
|
Yes, that seems reasonable, to report it as a redirection and then let the client handle trying again with the new URL, or handling it in whatever manner it desires. In other words, I don't think this package should do anything with the information, just report it as a 301. The GitHub API Developer docs just say: Anyway, I'm opening up this issue as an opportunity for a contributor to address. Thanks for the report, @Soulou! This would be a great PR for any new contributor to this repo or a new Go developer. Feel free to volunteer for any issue and the issue can be assigned to you so that others don't attempt to duplicate the work. Please check out our CONTRIBUTING.md guide to get started. Thank you! |
|
@gmlewis Thanks for your answer, I'll try to have a look if I've time :D |
|
can I take this up? |
|
Of course if you want it :-) |
|
Great thanks. (gmlewis: The following description is copied from closed PR #1249...) @gmlewis what I mean is the following: Without any renaming:
The API returns an URL which is directly usable by the client of the package Once the app has been renamed, 301 is returned with the following
So the user of this package would have to check if:
I think it would be really a lot of responsability for the user of this package, while if an additional roundtrip would be done here, it would be much easier and logical. |
|
So let's start over on this one. Specifically, for the I'm thinking that having the option to follow the redirect might be nice, and have that as the default option. So having a Before anyone jumps on this issue to implement it, let's first find out what @gauntface, @Soulou, or others think about this idea. |
|
Having an option is always good for the client, to analyse weird cases/bugs etc, so I agree with it. |
|
Would I be able to take a look at this? If so, are we looking for what has been described above? As I've understood it, a |
|
@jcockbain96 please, help yourself, thanks a lot! (Your implementation idea seems the right one to me, but I'm wondering if it shouldn't be the default and have a |
|
Okay great thanks! I agree that is should default to following redirects, I'll have a look now as to which way round ( |
|
Hi all, apologies for the delay in this one. I've got changes on a branch, but have a couple of questions about the implementation.
|
|
These are my opinions, and I'm totally open to discussion... First, naming the flag So, to answer question 1 above, I would say that for As for question 2 above, have you taken a look at https://golang.org/pkg/net/http/httptest/ and https://golang.org/pkg/net/http/httputil/ ? These are super-handy packages for mocking and testing real live (internal) connections that really use the http protocol, and I highly recommend them. |
Currently GetArchiveLink is only accepting 302:
go-github/github/repos_contents.go
Line 264 in 0830f28
But sometimes, a 301 is returned: I got errors like
unexpected status code: 301 Moved Permanentlywhich I assume is related to a renaming of repository.Shouldn't it be handled?
Thanks a lot
The text was updated successfully, but these errors were encountered: