gottp
gottp copied to clipboard
Idiomatic go
Refactored some code that looked pythonic with self as receivers. Added Comments for most Part of the code.
Comment worth reading in urls_handler.go :
// Get implements the method for UrlHandler. // It would be an advantage to have methods // implemented on urls in the response.
Fair point. Do you have anything in mind on how the response, for methods implemented on urls, should look like?
Yes. Infact i have a couple of points to be considered which are as follows.
- The current response looks like this Response :- {"data":{"RegisterUser":"/api/user","async_pipe":"^/async_pipe/?$","pipe":"^/pipe/?$","urls":"^/urls/?$"},"message":"","status":200}
I have only implemented POST method on the "RegisterUser" endpoint. It would be better if the response looked somewhat like this:-
Expected Response :- {"data":{"RegisterUser":{"Url":"/api/user", "Methods": ["POST"]}}, "message": "", "status": 200}
- However, the method OPTIONS is used exactly for that, i.e. knowing what methods are available for which particular endpoint. Hence the GlobalHandler should distinguish between request of OPTIONS method and set "Allow" header.
Please refer to the snippet I am sharing.

http://www.tutorialspoint.com/http/http_methods.htm
I am wanted to implement both the points today in my branch but i am confused on how to go about it. It will take time but i am hopeful, i will be able to complete it in a week or so.
Meanwhile do share your views on the same.
PS :- I have no idea on the Travis CI build error, I am sorry if your code broke