Commit Graph

750 Commits

Author SHA1 Message Date
Roberto Abdelkader Martínez Pérez
4c3fe37616 Theory documentation scaffolding 2019-11-20 11:22:42 +01:00
pancho horrillo
206aac5747 Rename package srverrors to httperror
- Package names are preferred to be in singular form¹.
- Since errors are just for HTTP and not generic, I changed the base name to
'http'.
- I didn't name it simply 'error', because it would then conflict with the
- standard 'error' interface.

¹: https://rakyll.org/style-packages/
2019-11-20 07:54:45 +01:00
pancho horrillo
0d66fe9963 Rename WriteErrorResponse() to simply ErrorJSON() and reorder arguments
This way we better mimic net/http.Error()

https://pkg.go.dev/net/http?tab=doc#Error
2019-11-20 07:37:35 +01:00
pancho horrillo
7ea43048bc Add missing comments 2019-11-20 07:14:00 +01:00
pancho horrillo
d81ef278da Update Makefile to make use of -trimpath build option
This option makes go build/install removes the absolute paths
within the produced executable, enabling more reproducible builds.

See ¹ for more details.

¹: https://golang.org/doc/go1.13?ref=hvper.com#go-command
2019-11-20 06:43:40 +01:00
pancho horrillo
75b0908b16 Rename GetReasonFromBody() to simply Reason()
See ¹ for the customary idiomatic way of naming getters in Go.

¹: https://golang.org/doc/effective_go.html#Getters
2019-11-20 05:04:10 +01:00
pancho horrillo
3a47b34bc1 Drop stale GetReason() and associated tests 2019-11-20 04:54:07 +01:00
pancho horrillo
b40f73115f Add missing comment to GetReasonFromBody() 2019-11-20 04:51:29 +01:00
pancho horrillo
b130cfdec7 Add some examples
Note that the example on redirecting a URL is BROKEN.  Possibly a bug in Kapow!
2019-11-19 21:52:10 +01:00
pancho horrillo
81c677c3be internal/http/request.go: replace GetReason() with GetReasonFromBody()
Update tests to inject the required JSON error body with reason.
2019-11-19 21:17:49 +01:00
pancho horrillo
e7619238ae Add GetReasonFromBody() that extracts reason from JSON 2019-11-19 21:17:34 +01:00
pancho horrillo
28f4b969f9 Update go.{mod,sum} recreating them from scratch
$ rm go.{mod,sum}; go mod init github.com/BBVA/kapow
go: creating new go.mod: module github.com/BBVA/kapow
$ go mod tidy -v
go: finding github.com/google/shlex latest

With this, we've gotten rid an unneeded dep (github.com/spf13/pflag @ v1.0.5).
2019-11-19 17:50:16 +01:00
pancho horrillo
806905c49c Update go.{mod,sum}
Set base version to go 1.13

and run:

$ go mod tidy -v
unused github.com/gogo/protobuf
unused github.com/golangci/gocyclo
unused github.com/golangci/golangci-lint
unused github.com/golangci/revgrep
unused github.com/gostaticanalysis/analysisutil
unused github.com/konsorten/go-windows-terminal-sequences
unused github.com/magiconair/properties
unused github.com/mattn/go-isatty
unused github.com/pelletier/go-toml
unused github.com/securego/gosec
unused github.com/spf13/afero
unused github.com/spf13/jwalterweatherman
unused github.com/uudashr/gocognit
unused golang.org/x/sys
unused golang.org/x/tools
unused mvdan.cc/unparam
unused sourcegraph.com/sqs/pbtypes
2019-11-19 17:32:28 +01:00
Roberto Abdelkader Martínez Pérez
4492bfdf54 Finish merge and recover README 2019-11-19 16:50:41 +01:00
Roberto Abdelkader Martínez Pérez
5462dd4323 Merge branch 'feature-new-doc' 2019-11-19 16:37:22 +01:00
pancho horrillo
83e4523dc7 Simplify files via gofmt -s (thanks, Go Report Card!) 2019-11-19 14:14:55 +01:00
pancho horrillo
92fbb72735 Fix typos catched via misspell (thanks Go Report Card!) 2019-11-19 14:07:58 +01:00
Roberto Abdelkader Martínez Pérez
12106338b0 Merge remote-tracking branch 'origin/master' into feature-new-doc 2019-11-19 13:02:48 +01:00
Roberto Abdelkader Martínez Pérez
2313b2b933 Update working with forms 2019-11-19 13:00:13 +01:00
Roberto Abdelkader Martínez Pérez
4144e2be9e Update working_with_forms.rst 2019-11-19 12:49:27 +01:00
Roberto Abdelkader Martínez Pérez
0e9bf9ff54 Working with forms example 2019-11-19 12:45:17 +01:00
Roberto Abdelkader Martínez Pérez
bc917ff166 Update README.rst 2019-11-19 11:03:42 +01:00
Roberto Abdelkader Martínez Pérez
c82cfd5bc2 Go Report Card badge 2019-11-19 09:30:06 +01:00
Héctor Hurtado
7bca5b8577 New error handling added to module resource in package data. Minor coding improvements. 2019-11-18 19:09:55 +01:00
pancho horrillo
1249b23458 Fix case mismatch in error JSON (adding tag) 2019-11-18 17:44:39 +01:00
Héctor Hurtado
4c7eae8ebb New error handling added to getRequestBody function in data package 2019-11-18 15:01:02 +01:00
Héctor Hurtado
e4b3a4f718 New error handling added to server and decorator module in data package 2019-11-18 14:52:52 +01:00
Héctor Hurtado
edff842c3b New srverrors package added. New error handling added to control package 2019-11-18 14:32:54 +01:00
Roberto Abdelkader Martínez Pérez
2c32daedcb Default value in case there is no header 2019-11-18 10:31:00 +01:00
pancho horrillo
402bbf00d7 Fix style in comment 2019-11-15 21:00:21 +01:00
Roberto Abdelkader Martínez Pérez
0397ad647f Update README.rst 2019-11-15 13:33:34 +01:00
Roberto Abdelkader Martínez Pérez
6b3413a8d4 Documentation WIP 2019-11-15 13:31:43 +01:00
pancho horrillo
3af5def406 poc: make error_body(reason) return a JSON with extraneous fields
We then ensure that the cucumber steps only test the
presence of the required fields, not just comparing it byte-wise.

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-11-14 17:40:47 +01:00
pancho horrillo
03de51e6ca Fix missing quotes in step
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-11-14 17:13:34 +01:00
Héctor Hurtado
ee9bb8df9c New error handling in poc and features 2019-11-14 15:05:19 +01:00
pancho horrillo
9ebc989bc7 poc/Makefile: add 'fix' target (mirroring spec/Makefile) 2019-11-14 17:53:32 +01:00
pancho horrillo
3e2bc44c0b spec/Makefile: on fix target, skip tagged scenarios and features
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-11-14 17:53:02 +01:00
Héctor Hurtado
e6b779dfbb Specification modified to include changes in error responses 2019-11-14 13:51:16 +01:00
Héctor Hurtado
ec788f68c2 Added documentation comments to the control package 2019-11-14 12:10:00 +01:00
pancho horrillo
f43e47f4f1 Remove leftover script 2019-11-14 11:57:44 +01:00
Roberto Abdelkader Martínez Pérez
ffeb668ea9 Fix readthedocs compilation 2019-11-14 10:34:36 +01:00
Roberto Abdelkader Martínez Pérez
95a6c7597f Sphinx documentation quickstart plus README.md and README.rst merge. 2019-11-14 10:12:29 +01:00
Héctor Hurtado
0618e55ce0 New documentation. Resume, short example and intallation 2019-11-13 21:18:30 +01:00
pancho horrillo
2d5743af84 Add blank line between legal header and package declaration
Otherwise, the legal header is rendered as package documentation.
2019-11-13 18:18:44 +01:00
Roberto Abdelkader Martínez Pérez
19bc0df968 Old poc examples were full of injections due to migration strategy. Will be rewritten in doc. 2019-11-12 13:16:30 +01:00
Roberto Abdelkader Martínez Pérez
049081c8b0 Update topdf 2019-11-12 13:06:31 +01:00
Roberto Abdelkader Martínez Pérez
1566dcf30f Sanitize input 2019-11-12 13:05:25 +01:00
Roberto Abdelkader Martínez Pérez
653fc3eb32 Escape input 2019-11-12 13:04:29 +01:00
pancho horrillo
822e4f85df spec: clarify the order of the execution of the tests
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-11-11 18:02:07 +01:00
pancho horrillo
6194c6961a Tweak PoC to pass current test suite
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-11-11 17:47:28 +01:00