Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Some routes are not working #1

Closed
malud opened this issue Aug 17, 2017 · 1 comment
Closed

Some routes are not working #1

malud opened this issue Aug 17, 2017 · 1 comment

Comments

@malud
Copy link
Contributor

malud commented Aug 17, 2017

The routes with URLparams are not working currently.

@master branch:

make run
Successfully built f83769b68199
>>> Starting mgob container
f75cb6474318021421d1b2ef7003a07095e5a935dd9bdf42426fe665dff15663
➜  mgob git:(master) docker ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                    NAMES
f75cb6474318        stefanprodan/mgob:0.5   "./mgob -ConfigPat..."   7 seconds ago       Up 5 seconds        0.0.0.0:8090->8090/tcp   mgob-0.5

curl -v http://localhost:8090/status
*   Trying ::1...
* Connected to localhost (::1) port 8090 (#0)
> GET /status HTTP/1.1
> Host: localhost:8090
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Thu, 17 Aug 2017 13:43:35 GMT
< Content-Length: 113
< 
[{"plan":"mongo-dev","next_run":"2017-08-17T13:45:00Z"},{"plan":"mongo-test","next_run":"2017-08-17T13:44:00Z"}]
* Connection #0 to host localhost left intact

curl -v -X POST http://localhost:8090/backup/mongo-dev
*   Trying ::1...
* Connected to localhost (::1) port 8090 (#0)
> POST /backup/mongo-dev HTTP/1.1
> Host: localhost:8090
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Thu, 17 Aug 2017 13:44:00 GMT
< Content-Length: 19
< 
404 page not found
* Connection #0 to host localhost left intact

Expected, at least a 500 error response.

I have changed:

r.Route("/backup", func(r chi.Router) {
		r.Use(configCtx(*s.Config))
		r.Post("/:planID", postBackup)
	})

to

r.Route("/backup", func(r chi.Router) {
		r.Use(configCtx(*s.Config))
		r.Post("/{planID}", postBackup)
	})

which result is the expected outcome:

curl -v -X POST http://localhost:8090/backup/mongo-dev
*   Trying ::1...
* Connected to localhost (::1) port 8090 (#0)
> POST /backup/mongo-dev HTTP/1.1
> Host: localhost:8090
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Date: Thu, 17 Aug 2017 13:51:18 GMT
< Content-Length: 132
< 
{"error":"mongodump log 2017-08-17T13:51:18.515+0000\tFailed: error connecting to db server: no reachable servers : exit status 1"}
* Connection #0 to host localhost left intact
stefanprodan added a commit that referenced this issue Aug 17, 2017
@stefanprodan
Copy link
Owner

Thanks @malud and @KevinBusse

I've published v0.6 on Docker hub with the fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants