I am trying to make a REST request to a Neo4j instance hosted via heroku. The server is setup with Basic Authentication.
This is the url I was provided with from Heroku (notice the trailing slash): http://username:password@instance.hosted.neo4j.org:123/db/data/
I’m using RestSharp to connect to this instance. However, RestSharp will remove the trailing slash. Code. The resulting url becomes: http://username:password@instance.hosted.neo4j.org:123/db/data
This results in a HTTP 301 to (notice the trailing slash): http://username:password@instance.hosted.neo4j.org:123/db/data/
The problem is that the Authorization Header is not persisted across redirects MSDN. This redirect results in HTTP 401.
Are there any obvious ways around this? I’ve tried the following:
- Provide 2 trailing slashes
/db/data//so RestSharp only removed one slash but leaves one remaining. This doesn’t work as other requests have invalid formats:/db/data//query/stuff - Use
CredentialCacheclass. This works but results in 2 requests per action (One for the 401 challenge, another one for the response) IAuthenticationModlue– Found minimal info on this in MSDN but after trying a custom class, this will still result in the double hop issue noted previously.Change the initial rest request to beRestSharp removes all ending slashesnew RestRequest("/", Method.GET);instead ofnew RestRequest("", Method.GET);– the only probelm is I don’t want to modify the Open Source project that is in between my app and RestSharp for my specific needs.
From pete at the Google Group:
https://groups.google.com/forum/?fromgroups#!topic/restsharp/8mBmaXksmsg