3
0

Fix multipart codegen

This commit is contained in:
Denis Arh
2018-10-22 13:24:04 +02:00
parent 9e095282c5
commit 6ea52301f4
10 changed files with 295 additions and 241 deletions

View File

@@ -40,9 +40,7 @@ func NewAttachmentOriginal() *AttachmentOriginal {
return &AttachmentOriginal{}
}
func (a *AttachmentOriginal) Fill(r *http.Request) error {
var err error
func (a *AttachmentOriginal) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(a)
@@ -54,7 +52,10 @@ func (a *AttachmentOriginal) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -86,9 +87,7 @@ func NewAttachmentPreview() *AttachmentPreview {
return &AttachmentPreview{}
}
func (a *AttachmentPreview) Fill(r *http.Request) error {
var err error
func (a *AttachmentPreview) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(a)
@@ -100,7 +99,10 @@ func (a *AttachmentPreview) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()

View File

@@ -17,15 +17,13 @@ package request
import (
"encoding/json"
"github.com/go-chi/chi"
"github.com/jmoiron/sqlx/types"
"github.com/pkg/errors"
"io"
"mime/multipart"
"net/http"
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/go-chi/chi"
"github.com/jmoiron/sqlx/types"
"github.com/pkg/errors"
)
var _ = chi.URLParam
@@ -41,9 +39,7 @@ func NewChannelList() *ChannelList {
return &ChannelList{}
}
func (c *ChannelList) Fill(r *http.Request) error {
var err error
func (c *ChannelList) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -55,7 +51,10 @@ func (c *ChannelList) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -89,9 +88,7 @@ func NewChannelCreate() *ChannelCreate {
return &ChannelCreate{}
}
func (c *ChannelCreate) Fill(r *http.Request) error {
var err error
func (c *ChannelCreate) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -103,7 +100,10 @@ func (c *ChannelCreate) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -147,9 +147,7 @@ func NewChannelEdit() *ChannelEdit {
return &ChannelEdit{}
}
func (c *ChannelEdit) Fill(r *http.Request) error {
var err error
func (c *ChannelEdit) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -161,7 +159,10 @@ func (c *ChannelEdit) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -209,9 +210,7 @@ func NewChannelRead() *ChannelRead {
return &ChannelRead{}
}
func (c *ChannelRead) Fill(r *http.Request) error {
var err error
func (c *ChannelRead) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -223,7 +222,10 @@ func (c *ChannelRead) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -251,9 +253,7 @@ func NewChannelDelete() *ChannelDelete {
return &ChannelDelete{}
}
func (c *ChannelDelete) Fill(r *http.Request) error {
var err error
func (c *ChannelDelete) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -265,7 +265,10 @@ func (c *ChannelDelete) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -293,9 +296,7 @@ func NewChannelMembers() *ChannelMembers {
return &ChannelMembers{}
}
func (c *ChannelMembers) Fill(r *http.Request) error {
var err error
func (c *ChannelMembers) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -307,7 +308,10 @@ func (c *ChannelMembers) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -336,9 +340,7 @@ func NewChannelJoin() *ChannelJoin {
return &ChannelJoin{}
}
func (c *ChannelJoin) Fill(r *http.Request) error {
var err error
func (c *ChannelJoin) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -350,7 +352,10 @@ func (c *ChannelJoin) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -380,9 +385,7 @@ func NewChannelPart() *ChannelPart {
return &ChannelPart{}
}
func (c *ChannelPart) Fill(r *http.Request) error {
var err error
func (c *ChannelPart) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -394,7 +397,10 @@ func (c *ChannelPart) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -424,9 +430,7 @@ func NewChannelInvite() *ChannelInvite {
return &ChannelInvite{}
}
func (c *ChannelInvite) Fill(r *http.Request) error {
var err error
func (c *ChannelInvite) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -438,7 +442,10 @@ func (c *ChannelInvite) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -468,9 +475,7 @@ func NewChannelAttach() *ChannelAttach {
return &ChannelAttach{}
}
func (c *ChannelAttach) Fill(r *http.Request) error {
var err error
func (c *ChannelAttach) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(c)
@@ -482,7 +487,10 @@ func (c *ChannelAttach) Fill(r *http.Request) error {
}
}
r.ParseMultipartForm()
if err = r.ParseMultipartForm(32 << 20); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -494,8 +502,6 @@ func (c *ChannelAttach) Fill(r *http.Request) error {
post[name] = string(param[0])
}
spew.Dump(post)
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
if val, ok := post["replyTo"]; ok {

View File

@@ -40,9 +40,7 @@ func NewMessageCreate() *MessageCreate {
return &MessageCreate{}
}
func (m *MessageCreate) Fill(r *http.Request) error {
var err error
func (m *MessageCreate) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -54,7 +52,10 @@ func (m *MessageCreate) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -87,9 +88,7 @@ func NewMessageHistory() *MessageHistory {
return &MessageHistory{}
}
func (m *MessageHistory) Fill(r *http.Request) error {
var err error
func (m *MessageHistory) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -101,7 +100,10 @@ func (m *MessageHistory) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -135,9 +137,7 @@ func NewMessageEdit() *MessageEdit {
return &MessageEdit{}
}
func (m *MessageEdit) Fill(r *http.Request) error {
var err error
func (m *MessageEdit) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -149,7 +149,10 @@ func (m *MessageEdit) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -183,9 +186,7 @@ func NewMessageDelete() *MessageDelete {
return &MessageDelete{}
}
func (m *MessageDelete) Fill(r *http.Request) error {
var err error
func (m *MessageDelete) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -197,7 +198,10 @@ func (m *MessageDelete) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -228,9 +232,7 @@ func NewMessageSearch() *MessageSearch {
return &MessageSearch{}
}
func (m *MessageSearch) Fill(r *http.Request) error {
var err error
func (m *MessageSearch) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -242,7 +244,10 @@ func (m *MessageSearch) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -279,9 +284,7 @@ func NewMessagePin() *MessagePin {
return &MessagePin{}
}
func (m *MessagePin) Fill(r *http.Request) error {
var err error
func (m *MessagePin) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -293,7 +296,10 @@ func (m *MessagePin) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -323,9 +329,7 @@ func NewMessageGetReplies() *MessageGetReplies {
return &MessageGetReplies{}
}
func (m *MessageGetReplies) Fill(r *http.Request) error {
var err error
func (m *MessageGetReplies) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -337,7 +341,10 @@ func (m *MessageGetReplies) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -368,9 +375,7 @@ func NewMessageCreateReply() *MessageCreateReply {
return &MessageCreateReply{}
}
func (m *MessageCreateReply) Fill(r *http.Request) error {
var err error
func (m *MessageCreateReply) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -382,7 +387,10 @@ func (m *MessageCreateReply) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -416,9 +424,7 @@ func NewMessageUnpin() *MessageUnpin {
return &MessageUnpin{}
}
func (m *MessageUnpin) Fill(r *http.Request) error {
var err error
func (m *MessageUnpin) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -430,7 +436,10 @@ func (m *MessageUnpin) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -460,9 +469,7 @@ func NewMessageFlag() *MessageFlag {
return &MessageFlag{}
}
func (m *MessageFlag) Fill(r *http.Request) error {
var err error
func (m *MessageFlag) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -474,7 +481,10 @@ func (m *MessageFlag) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -504,9 +514,7 @@ func NewMessageUnflag() *MessageUnflag {
return &MessageUnflag{}
}
func (m *MessageUnflag) Fill(r *http.Request) error {
var err error
func (m *MessageUnflag) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -518,7 +526,10 @@ func (m *MessageUnflag) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -549,9 +560,7 @@ func NewMessageReact() *MessageReact {
return &MessageReact{}
}
func (m *MessageReact) Fill(r *http.Request) error {
var err error
func (m *MessageReact) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -563,7 +572,10 @@ func (m *MessageReact) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -595,9 +607,7 @@ func NewMessageUnreact() *MessageUnreact {
return &MessageUnreact{}
}
func (m *MessageUnreact) Fill(r *http.Request) error {
var err error
func (m *MessageUnreact) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(m)
@@ -609,7 +619,10 @@ func (m *MessageUnreact) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()

View File

@@ -39,9 +39,7 @@ func NewOrganisationList() *OrganisationList {
return &OrganisationList{}
}
func (o *OrganisationList) Fill(r *http.Request) error {
var err error
func (o *OrganisationList) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(o)
@@ -53,7 +51,10 @@ func (o *OrganisationList) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -84,9 +85,7 @@ func NewOrganisationCreate() *OrganisationCreate {
return &OrganisationCreate{}
}
func (o *OrganisationCreate) Fill(r *http.Request) error {
var err error
func (o *OrganisationCreate) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(o)
@@ -98,7 +97,10 @@ func (o *OrganisationCreate) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -130,9 +132,7 @@ func NewOrganisationEdit() *OrganisationEdit {
return &OrganisationEdit{}
}
func (o *OrganisationEdit) Fill(r *http.Request) error {
var err error
func (o *OrganisationEdit) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(o)
@@ -144,7 +144,10 @@ func (o *OrganisationEdit) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -176,9 +179,7 @@ func NewOrganisationRemove() *OrganisationRemove {
return &OrganisationRemove{}
}
func (o *OrganisationRemove) Fill(r *http.Request) error {
var err error
func (o *OrganisationRemove) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(o)
@@ -190,7 +191,10 @@ func (o *OrganisationRemove) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -218,9 +222,7 @@ func NewOrganisationRead() *OrganisationRead {
return &OrganisationRead{}
}
func (o *OrganisationRead) Fill(r *http.Request) error {
var err error
func (o *OrganisationRead) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(o)
@@ -232,7 +234,10 @@ func (o *OrganisationRead) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -263,9 +268,7 @@ func NewOrganisationArchive() *OrganisationArchive {
return &OrganisationArchive{}
}
func (o *OrganisationArchive) Fill(r *http.Request) error {
var err error
func (o *OrganisationArchive) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(o)
@@ -277,7 +280,10 @@ func (o *OrganisationArchive) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()

View File

@@ -39,9 +39,7 @@ func NewTeamList() *TeamList {
return &TeamList{}
}
func (t *TeamList) Fill(r *http.Request) error {
var err error
func (t *TeamList) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -53,7 +51,10 @@ func (t *TeamList) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -85,9 +86,7 @@ func NewTeamCreate() *TeamCreate {
return &TeamCreate{}
}
func (t *TeamCreate) Fill(r *http.Request) error {
var err error
func (t *TeamCreate) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -99,7 +98,10 @@ func (t *TeamCreate) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -132,9 +134,7 @@ func NewTeamEdit() *TeamEdit {
return &TeamEdit{}
}
func (t *TeamEdit) Fill(r *http.Request) error {
var err error
func (t *TeamEdit) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -146,7 +146,10 @@ func (t *TeamEdit) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -178,9 +181,7 @@ func NewTeamRead() *TeamRead {
return &TeamRead{}
}
func (t *TeamRead) Fill(r *http.Request) error {
var err error
func (t *TeamRead) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -192,7 +193,10 @@ func (t *TeamRead) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -220,9 +224,7 @@ func NewTeamRemove() *TeamRemove {
return &TeamRemove{}
}
func (t *TeamRemove) Fill(r *http.Request) error {
var err error
func (t *TeamRemove) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -234,7 +236,10 @@ func (t *TeamRemove) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -262,9 +267,7 @@ func NewTeamArchive() *TeamArchive {
return &TeamArchive{}
}
func (t *TeamArchive) Fill(r *http.Request) error {
var err error
func (t *TeamArchive) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -276,7 +279,10 @@ func (t *TeamArchive) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -305,9 +311,7 @@ func NewTeamMove() *TeamMove {
return &TeamMove{}
}
func (t *TeamMove) Fill(r *http.Request) error {
var err error
func (t *TeamMove) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -319,7 +323,10 @@ func (t *TeamMove) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()
@@ -352,9 +359,7 @@ func NewTeamMerge() *TeamMerge {
return &TeamMerge{}
}
func (t *TeamMerge) Fill(r *http.Request) error {
var err error
func (t *TeamMerge) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(t)
@@ -366,7 +371,10 @@ func (t *TeamMerge) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()

View File

@@ -39,9 +39,7 @@ func NewUserSearch() *UserSearch {
return &UserSearch{}
}
func (u *UserSearch) Fill(r *http.Request) error {
var err error
func (u *UserSearch) Fill(r *http.Request) (err error) {
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(r.Body).Decode(u)
@@ -53,7 +51,10 @@ func (u *UserSearch) Fill(r *http.Request) error {
}
}
r.ParseForm()
if err = r.ParseForm(); err != nil {
return err
}
get := map[string]string{}
post := map[string]string{}
urlQuery := r.URL.Query()