helpers.go 678 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package apiserv
  2. import "net/http"
  3. // http.MethodDelete
  4. // http.MethodGet
  5. // http.MethodOptions
  6. // http.MethodPatch
  7. // http.MethodPost
  8. // http.MethodPut
  9. type TMethods []string
  10. func Methods() TMethods {
  11. return []string{}
  12. }
  13. func (m TMethods) Delete() TMethods {
  14. return append(m, http.MethodDelete)
  15. }
  16. func (m TMethods) Get() TMethods {
  17. return append(m, http.MethodGet)
  18. }
  19. func (m TMethods) Options() TMethods {
  20. return append(m, http.MethodOptions)
  21. }
  22. func (m TMethods) Patch() TMethods {
  23. return append(m, http.MethodPatch)
  24. }
  25. func (m TMethods) Post() TMethods {
  26. return append(m, http.MethodPost)
  27. }
  28. func (m TMethods) Put() TMethods {
  29. return append(m, http.MethodPut)
  30. }