pancho horrillo
b4f2e9ffdd
Refactor tests
...
* Get rid of spurious model.Route{} var, by adding content
directly into model.Handler{} literal.
* Adjust spacing to adhere to the prepare-call-test test structure.
2019-10-13 08:17:16 +02:00
pancho horrillo
c62a0d6a9a
Sort imports intro three blocks (stdlib, non-stdlib, current prj)
2019-10-13 08:09:15 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
df5d38e94f
swappableMux is now public and Append() now updates Server.Handler
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-10 20:22:09 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
b4dd6e9805
Add New() func & Update() method to internal/server/user/mux/swappableMux
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-10 19:26:17 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
463382bfb2
Add internal/server/user/mux/handlerbuilder{,_test}.go
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-10 18:16:15 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
2129c4a1f6
internal/server/model.Handler.Route is no longer a pointer
...
Also Spawn() now checks if entrypoint is not set
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-10 18:16:15 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
b76fb1f77e
Add method ListIDs() to internal/data/Handlers
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-10 13:11:05 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
a39e0f6605
Spawner ready
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-10 11:49:58 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
d0764f07a4
First cut to spawner
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-09 18:28:33 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
fa8cc271dc
Build jaillover via Makefile
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-09 16:25:04 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
273058c3ba
Add testutils/jaillover to assist testing process spawning
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-09 16:17:21 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
49252a78a6
Fix misuse of gorilla/mux.Router{} use mux.NewRouter() instead
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-09 15:22:50 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
401644b65e
Finish gorillize()
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-09 13:10:04 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
2cd96d5a4b
Add the controversial gorillize()
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-08 19:39:44 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
037347dbe3
Augment safeRouteList.Append() to return a model.Route with index
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-08 17:53:15 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
e0dd6f5dd5
Refactor internal/server/user package structure
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-08 17:22:09 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
2eb32610a0
Exclude test from race condition verification
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-08 15:34:42 +02:00
9ad61249b3
Fix linter warning
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-08 15:33:32 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
3b405bd9f6
Add ServeHTTP() method to swappableMux struct
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-08 15:06:08 +02:00
pancho horrillo
0cab49f082
Simplify handling of http.Client response
...
As per the doc¹:
If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close.
...
On error, any Response can be ignored. A non-nil Response with a non-nil error
only occurs when CheckRedirect fails, and even then the returned Response.Body
is already closed.
It is thus safe to defer res.Body.Close() as soon as err has been determined to
be nil.
Also, I've dispensed with the separate variable client, since it is not used
later.
¹: https://godoc.org/net/http#Client.Do
2019-10-08 05:42:33 +02:00
pancho horrillo
7ba54b32b3
Revert to using strings for simplicity
...
It is safe in this case.
* gock.BodyString(body string) coerces body into a []byte
* client.SetData() eventually resolves to a call to http.Client.Do(), which
handles the string gracefully as well.
2019-10-08 05:28:29 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
10586bae95
Add internal/server/user/server{,_test}.go
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-10-07 19:05:59 +02:00
pancho horrillo
0b056f6cf0
internal/client/{get,set}_test.go: send io.Writer() based on []byte
...
* internal/client/get_test.go:
- Revert changes when setting the Body of the mock (gock).
- Revert over-eager line splitting.
* internal/client/set_test.go:
- Use bytes.NewReader([]byte("200")) instead of strings.NewReader("200")
Thanks to @nilp0inter for the feedback!
2019-10-06 11:34:15 +02:00
pancho horrillo
f98784088d
Normalize internal/client/*_test.go
...
* Adjust test style for easy reading, by using literals instead of vars
* Move comparison to the `bytes` domain, instead of `string`
* Simplify testing code by using bytes.Buffer directly
* More consistent naming of variables and dummies (HANDLE_{FOO,BAR,BAD})
* Consistent testing style of gock.IsDone()
* Stick to 80-column
2019-10-06 09:41:12 +02:00
pancho horrillo
6154210b3f
Update PoC and features with the 204 -> 404 update
...
Closes #33
2019-10-04 17:24:27 +02:00
pancho horrillo and Héctor Hurtado
a865ade26a
Use string concatenation to compose simple expression
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-04 07:28:08 +02:00
pancho horrillo and Héctor Hurtado
57d1aabb66
internal/cmd/route.go: replace dummies with calls to client code
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-04 06:46:40 +02:00
pancho horrillo and Héctor Hurtado
b9bf78abf4
Fix route_add{,_test}.go to use an io.Writer for saving the response
...
Also add a TODO regarding untested response payload.
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-04 06:28:17 +02:00
pancho horrillo and Héctor Hurtado
219710bb76
Fix documentation comment
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-04 06:04:56 +02:00
pancho horrillo
c65d2ac548
Don't set MatchType to json in gock for requests without body
2019-10-03 22:50:42 +02:00
pancho horrillo
c01c3db4f9
Fix indentation and drop spurious whitespace
2019-10-03 22:48:21 +02:00
pancho horrillo
df96d322fc
Don't set Content-Type to application/json in query without body
2019-10-03 22:47:43 +02:00
pancho horrillo and Héctor Hurtado
604569c7a3
Add internal/client/route_list{,_test}.go
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-03 22:42:31 +02:00
pancho horrillo and Héctor Hurtado
013cd4d637
Add internal/client/route_remove{,_test}.go
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-03 18:22:18 +02:00
pancho horrillo and Héctor Hurtado
306889c958
Add TODO on closing the connection of the http.Client
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-03 16:52:55 +02:00
pancho horrillo and Héctor Hurtado
ffa262b2b6
Simplify internal/client/set.go by leveraging internal/http.Request()
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-03 16:52:15 +02:00
pancho horrillo and Héctor Hurtado
23128026c7
Rework directory structure
...
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com >
2019-10-03 12:05:53 +02:00
pancho horrillo
27cf52467d
poc: Drop unused import
2019-09-16 10:24:11 +02:00
pancho horrillo
19bb6320b9
spec: Fix command name start -> server
2019-09-16 09:19:19 +02:00
pancho horrillo
32d0a00c43
Merge pull request #26 from BBVA/fix/style
...
Style fixes and minor typos.
2019-09-09 14:45:28 +02:00
pancho horrillo
b4b5052149
Revert "Style fix."
...
This reverts commit 5c72f3a498 .
Thanks to @nilp0inter for clarifying this one as well.
2019-09-09 14:40:52 +02:00
pancho horrillo
94135c6ab9
Revert "Style fix."
...
Thanks to @nilp0inter for pointing out that this was not Basic English.
This reverts commit 0eb51f12ac .
2019-09-09 14:30:07 +02:00
pancho horrillo
567f68b695
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
28c16409a8
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
84f6a89c2d
Clarify expression.
2019-09-06 13:55:22 +02:00
pancho horrillo
ff0f3aefc5
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
249d0f3e9f
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
41d8f39c9a
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
5c72f3a498
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
3a545ac7b3
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
0eb51f12ac
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
36a61285b9
Style fix.
...
Note: "midst" tends to be used in more literary settings.
2019-09-06 13:55:22 +02:00
pancho horrillo
b22f3a5adb
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
42403fe78c
Style fix.
2019-09-06 13:55:22 +02:00
pancho horrillo
9fdd75f6d8
Fix typo.
2019-09-06 13:55:22 +02:00
pancho horrillo
479e3cb13b
Fix markdown and add missing -E param to sudo.
2019-09-06 13:54:43 +02:00
pancho horrillo
b577dd93d3
Fix usage of sudo to prevent issues with the environment.
...
Also fix a couple of typos.
2019-09-06 13:48:51 +02:00
pancho horrillo
667d081de5
Merge pull request #24 from BBVA/feature/overwrite-resource-scenario
...
Add scenario to the test suite where overwriting resources is checked.
2019-09-06 09:21:19 +02:00
pancho horrillo
157886c3a5
Add scenario to the test suite where overwriting resources is checked.
...
Thanks to @nilp0inter for providing justification for the scenario.
2019-09-05 18:57:47 +02:00
pancho horrillo
2b64e1cb92
Merge branch 'hotfix-control-access'
2019-07-05 10:40:29 +02:00
pancho horrillo
23c66f4794
Use '127.0.0.1' instead of 'localhost' to prevent IPv6 resolution errors in Docker
2019-07-04 12:22:04 +02:00
pancho horrillo
fc4f4ac8cb
README.rst: fix link to the spec
2019-07-01 15:59:30 +02:00
pancho horrillo
00b539b1aa
README.rst: style fixes
2019-07-01 15:56:56 +02:00
pancho horrillo
01d1bf6038
doc/readme.rst: fix docker image build instructions
2019-07-01 15:42:16 +02:00
pancho horrillo
9d1937ebbf
poc/examples/nmap/Dockerfile: make use of published docker image @ hub.docker.com
2019-07-01 15:37:47 +02:00
pancho horrillo
6af8fe7256
Merge branch 'develop'
2019-06-28 10:33:29 +02:00
pancho horrillo
b058136eb2
poc/examples/pdfeditor/pdfeditor.pow: remove trailing whitespace
2019-06-27 10:12:08 +02:00
pancho horrillo
9b474d0d23
poc: add script for generating the docker image
2019-06-20 10:04:51 +02:00
pancho horrillo
4244ceba24
poc/examples/nmap/Dockerfile: revert version bump in base image
2019-06-19 11:48:57 +02:00
pancho horrillo
04715abbe1
poc/examples/nmap/Dockerfile: tidy it a little bit
2019-06-18 15:50:24 +02:00
pancho horrillo
1c7b2c5e96
poc/Dockerfile: tidy it a little bit
2019-06-18 15:49:57 +02:00
pancho horrillo
16145da7a5
README.md: fix style for clarity
2019-06-18 15:29:01 +02:00
pancho horrillo and César Gallego Rodríguez
b0e640716f
README.md: style fix
...
Co-authored-by: César Gallego Rodríguez <cesar.gallego.next@bbva.com >
2019-06-18 11:08:37 +02:00
pancho horrillo
304c31d1ba
Merge pull request #1 from BBVA/server-as-subcommand
...
"kapow route" and "kapow server" in PoC
2019-06-05 09:51:14 +00:00
pancho horrillo
d067b46d11
spec: fix quoting style
2019-05-31 13:43:46 +02:00
pancho horrillo and César Gallego Rodríguez
60e7a57622
spec: explanation of the executables
...
Co-authored-by: César Gallego Rodríguez <cesar.gallego.next@bbva.com >
2019-05-31 13:43:46 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
02fce05303
spec: resolve a FIXUP regarding a sample call
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-29 16:36:45 +02:00
f45e1be194
spec: add missing note on handlers
...
Co-authored-by: César Gallego Rodríguez <cesar.gallego.next@bbva.com >
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-29 16:36:45 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
da72ccbf70
spec: add missing explicit line breaks
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-29 16:36:45 +02:00
pancho horrillo
823974551d
spec: enable syntax highlighting for code snippets
2019-05-29 16:36:42 +02:00
pancho horrillo
0384d81b9f
spec: add UNIX® registered sign
2019-05-29 16:20:01 +02:00
pancho horrillo
8e97efda31
spec: resolve a couple more TODOs
2019-05-29 16:19:53 +02:00
pancho horrillo and César Gallego Rodríguez
49a3dea091
spec: render table with native github-flavoured markdown
...
Co-authored-by: César Gallego Rodríguez <cesar.gallego.next@bbva.com >
2019-05-29 10:40:43 +02:00
pancho horrillo and César Gallego Rodríguez
6ad5417a66
spec: resolve a bunch of TODOs and add some tweaks
...
Co-authored-by: César Gallego Rodríguez <cesar.gallego.next@bbva.com >
2019-05-29 10:40:30 +02:00
pancho horrillo and César Gallego Rodríguez
af0d8658d9
spec: fix OK status code for POST (200->201)
...
Co-authored-by: César Gallego Rodríguez <cesar.gallego.next@bbva.com >
2019-05-29 09:38:46 +02:00
pancho horrillo
019356b7ae
spec: misc style tweaks
2019-05-28 15:42:03 +02:00
pancho horrillo
123d88fc5d
poc: fix executable permissions to .pow scripts
2019-05-28 15:42:02 +02:00
pancho horrillo
f091f3c566
poc: add tester to eval example
2019-05-28 15:41:59 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
0938fc225e
poc: add tester for pandoc example
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-28 15:41:57 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
dc253f7485
Sync poc to spec
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-28 15:41:54 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
e4cbb96cf4
spec: add missing /response/cookies handler
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-27 11:40:40 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
a3b857f8e5
spec: add missing /request/files handler
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-27 11:34:32 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
8dbb3fb764
spec: document route deletion
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-21 13:10:40 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
86da4dbce7
specs: Add missing header
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-21 13:09:34 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
f14429701b
Add HTTP API design principles
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-21 13:07:26 +02:00
pancho horrillo and Roberto Abdelkader Martínez Pérez
79d7e3be04
Document /routes get and append
...
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com >
2019-05-20 15:20:25 +02:00
pancho horrillo
8acf8fa4b4
Use GET instead of POST in nmap example
2019-05-13 11:48:42 +02:00
pancho horrillo
e588785dd1
poc/kapow: fix function name
2019-05-10 16:37:49 +02:00
pancho horrillo
bdf93674dc
Add missing braces around var in format string
2019-05-10 16:33:08 +02:00
pancho horrillo
09cf8b0b5a
Give some love to README.md
2019-05-10 16:27:38 +02:00