Standard library / mime/multipart
multipart.Writer.FormDataContentType()
Construct the multipart/form-data media type with the correct boundary parameter. Expected stdout: 'multipart/form-data; boundary=demo\n'.
Formal Syntax & Structure
go syntaxgo
func (w *Writer) FormDataContentType() stringReturn Value
string
Media type including boundary parameter.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt" "mime/multipart")
func main() { var b bytes.Buffer w := multipart.NewWriter(&b) check(w.SetBoundary("demo")) fmt.Println(w.FormDataContentType()) check(w.Close())}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}