Skip to content

add more response types, form binding support, tls support#5

Merged
KARTIKrocks merged 2 commits intomainfrom
feature-tls-support-and-form-binding
Feb 24, 2026
Merged

add more response types, form binding support, tls support#5
KARTIKrocks merged 2 commits intomainfrom
feature-tls-support-and-form-binding

Conversation

@KARTIKrocks
Copy link
Owner

Added

  • requestBindForm[T] and BindFormWithConfig[T] for application/x-www-form-urlencoded body binding with struct tags (form:"name")
  • requestBindMultipart[T] and BindMultipartWithConfig[T] for multipart/form-data body binding
  • requestFormFile(r, field) returns a single uploaded file header; FormFiles(r) returns all uploaded files
  • requestBind[T] now auto-detects content type: JSON, form, and multipart are dispatched automatically; unknown types return 415
  • requestBindJSON[T] and BindJSONWithConfig[T] for explicit JSON binding with content-type enforcement
  • requestMaxMultipartMemory field on Config (defaults to 32 MB) controls multipart memory threshold
  • requestform struct tag supported in field name resolution for validation errors (checked before json tag)
  • serverWithTLS(certFile, keyFile) option for HTTPS support
  • serverAddr() method returns the listener address after the server starts
  • responseXML(w, statusCode, data) writes XML responses with <?xml?> header
  • responseIndentedJSON(w, statusCode, data) writes pretty-printed JSON
  • responsePureJSON(w, statusCode, data) writes JSON without HTML escaping of <, >, &
  • responseJSONP(w, r, statusCode, data) writes JSONP responses (reads ?callback= query param)
  • responseReader(w, statusCode, contentType, contentLength, reader) streams from io.Reader

@KARTIKrocks KARTIKrocks self-assigned this Feb 24, 2026
@KARTIKrocks KARTIKrocks merged commit 3fcb381 into main Feb 24, 2026
3 checks passed
@KARTIKrocks KARTIKrocks deleted the feature-tls-support-and-form-binding branch February 24, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant