These are chat archives for gin-gonic/gin

30th
Oct 2017
Derek Robati
@drobati
Oct 30 2017 16:25
Hello, I was playing with the basic example. I didn't understand how to use the POST /admin. Also the GET /user/:name doesn't work because DB was empty.
I tried different combinations of curl commands, nothing seemed to work. I would just get 401s.
~ λ curl -d 'user=foo' http://localhost:8080/admin
~ λ curl -u foo:bar http://localhost:8080/admin
404 page not found
~ λ curl -d 'user=foo' -d 'pass=b' http://localhost:8080/admin
~ λ curl -d 'user=foo' -d 'passw=bar' http://localhost:8080/admin
~ λ curl -d 'user=foo' -d 'pass=bar' http://localhost:8080/admin
~ λ curl -d 'user=foo,pass=bar' http://localhost:8080/admin
~ λ curl -d '{"user":"foo","pass":"bar"}' -H 'Content-Type: application/json'  http://localhost:8080/admin
~ λ curl -d '{"user":"foo","password":"bar"}' -H 'Content-Type: application/json'  http://localhost:8080/admin
~ λ curl -d '{"user":"bar"}' -H 'Content-Type: application/json'  http://localhost:8080/admin
~ λ curl -d 'foo=bar' http://localhost:8080/admin
~ λ curl -d '{"foo":"bar"}' -H 'Content-Type: application/json'  http://localhost:8080/admin
~ λ curl http://localhost:8080/user/foo
{"status":"no value","user":"foo"}
~ λ curl http://localhost:8080/user/foo
{"db":{},"status":"no value","user":"foo"}
~ λ
In the last command I modified the GET /user/:name to return {..., "db": DB}
Derek Robati
@drobati
Oct 30 2017 17:54
Okay figured out curl -u 'manu' http://localhost:8080/admin gets some response. Still poking at it
Derek Robati
@drobati
Oct 30 2017 18:13
nvm figured it out thanks, I wasn't aware that basicauth used Authorized header