Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Google App Engine#27

Open
hraban wants to merge 2 commits intodrone:masterfrom
hraban:googleappengine
Open

Google App Engine#27
hraban wants to merge 2 commits intodrone:masterfrom
hraban:googleappengine

Conversation

@hraban
Copy link

@hraban hraban commented Feb 20, 2014

ready to use on GAE platform.

Necessary for Google App Engine because net/http.DefaultClient is not
available.

Default behavior unchanged.

Unit tests were failing so I didn't check with those.
fixes problems on GAE, whose http.Client implementation doesn't
automatically extract the user portion of a URL as basic auth.
@sanbornm
Copy link

sanbornm commented May 9, 2014

Can we get this merged in please?

@hraban
Copy link
Author

hraban commented May 20, 2014

I've been thinking about this; there is a minor problem. What if someone sets http.DefaultClient to the client supplied by GAE before every request? This would work before, but my patch caches the http.DefaultClient from stdlib and breaks that. I think it's better to set _httpClient to nil initially, then create an internal getter function. Something like:

func getHttpClient() *http.Client {
    if _httpClient == nil {
        return http.DefaultClient
    }
    return _httpClient
}

that should work transparently for people who don't read the docs and who don't expect this package to do anything GAE specific.

(untested)

@hraban
Copy link
Author

hraban commented May 20, 2014

PS Im not using this project or its code atm anymore so I can't vouch for this modification; someone who is more into it feel free to make the change, run the tests and make a pull request to my branch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants