aboutsummaryrefslogtreecommitdiff
path: root/contracts.go
diff options
context:
space:
mode:
authorAlexander Kiryukhin <a.kiryukhin@mail.ru>2022-01-09 08:03:03 +0300
committerAlexander Kiryukhin <a.kiryukhin@mail.ru>2022-01-09 08:03:03 +0300
commit6d99712a301a6225366c1f92cdaeb8b2e680120d (patch)
tree7ea101fc4d7e34235e45925c7c291ba35d983aea /contracts.go
parentb3c48f806724b82b649c89aa5e0d07a09e414140 (diff)
Added custom renderers
Diffstat (limited to 'contracts.go')
-rw-r--r--contracts.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/contracts.go b/contracts.go
new file mode 100644
index 0000000..01c9a8d
--- /dev/null
+++ b/contracts.go
@@ -0,0 +1,32 @@
+package api
+
+import "net/http"
+
+// Optional interfaces for request type
+
+//WithHeader sets headers to request
+type WithHeader interface {
+ WithHeader(header http.Header)
+}
+
+//WithMethod sets method to request
+type WithMethod interface {
+ WithMethod(method string)
+}
+
+// Optional interfaces for response type
+
+//Renderer renders response to byte slice
+type Renderer interface {
+ Render() ([]byte, error)
+}
+
+//WithContentType returns custom content type for response
+type WithContentType interface {
+ ContentType() string
+}
+
+//WithHTTPStatus returns custom status code
+type WithHTTPStatus interface {
+ Status() int
+}