Skip to content

Conversation

nanodeath
Copy link

@nanodeath nanodeath commented Mar 21, 2025

Hi there! This is a change to add support for multipart form uploads, e.g. file uploads. The Serverless Function mode already supports file uploads, but if you want to use them in your controllers (Application mode), we need something like this.

Previously, this module was using the query string decoder on the body for multipart uploads, which isn't right -- multipart form bodies have their own crazy syntax.

This adds support to the base ApiGatewayServletRequest for multipart/form-data requests and argument bindings for:

  • @Part String name (binding to a part of name name)
  • @Part("foo") String name
  • @Part("file") CompletedFileUpload file

This does NOT add support for:

  • Streaming file uploads (which I'm not sure we can easily support anyway)

This change is currently missing:

  • Unit tests for the new classes
  • Integration tests (?) for handling API Gateway events containing file uploads.
    • If this is something we need, I'd appreciate any pointers you have on how to implement this.

I've created a simple test project that can verify this works and can provide if there's interest.

Looking for feedback and direction on things that need to be implemented before this can be merged. Thanks!

  • Feedback on thread safety
  • Feedback on whether there's a better way to store file uploads -- they don't exactly fit in the parameters map, which is a String map.
  • Feedback on class visibility, package structure, annotations

Closes #270.

…atewayServletRequest

This adds support for parsing multipart/form-data in AWS API Gateway proxy requests.
The implementation handles boundary extraction, part parsing, and field name extraction
while maintaining compatibility with existing form handling.

Co-Authored-By: Claude <[email protected]>
@CLAassistant
Copy link

CLAassistant commented Mar 21, 2025

CLA assistant check
All committers have signed the CLA.

@graemerocher
Copy link
Contributor

Nice! Will review next week

@Gustl22
Copy link

Gustl22 commented Oct 15, 2025

@graemerocher Ping for review. Thanks for your time.

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.

Support for multipart upload for API Gateway

4 participants