Small changes

This commit is contained in:
webb 2020-07-19 07:53:59 -04:00
parent 74099b7ac2
commit a6d024ec5e
No known key found for this signature in database
GPG Key ID: 8B6F0D2784D22DB2
2 changed files with 6 additions and 3 deletions

View File

@ -10,8 +10,6 @@ import (
"strings"
)
var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"")
type loginResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
@ -24,6 +22,8 @@ type userResponse struct {
User User `json:"user"`
}
var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"")
/* createFormFileWithMIME is a modification of multipart.CreateFormFile() that
allows arbitrary mime-types. */
func createFormFileWithMIME(w *multipart.Writer, fieldname, filename string, mimeType string) (io.Writer, error) {

View File

@ -10,7 +10,10 @@ import (
)
// UploadFile attempts to upload file from io.Readerm and returns the response
func (c Client) UploadFile(rd io.Reader, n string) (response string, error error) {
func (c Client) UploadFile(reader io.Reader, name string) (response string, error error) {
rd := reader
n := name
r, w := io.Pipe()
m := multipart.NewWriter(w)
go func() {