micronaut-aws icon indicating copy to clipboard operation
micronaut-aws copied to clipboard

feat(function-aws-api-proxy): add multipart/form-data support to ApiGatewayServletRequest

Open nanodeath opened this issue 8 months ago • 3 comments
trafficstars

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.

nanodeath avatar Mar 21 '25 13:03 nanodeath

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 21 '25 13:03 CLAassistant

Nice! Will review next week

graemerocher avatar Mar 21 '25 20:03 graemerocher

@graemerocher Ping for review. Thanks for your time.

Gustl22 avatar Oct 15 '25 07:10 Gustl22