Skip to content

Support file attachments in request bodies #53

Description

@danielbowne

Problem

There is no way to attach files to requests in Emberfall. APIs that require file uploads (PDF processing, image analysis, document conversion) cannot be smoke tested.

Proposed Solution

Extend the multipart body type (see #52) to support file attachments from the local filesystem:

tests:
  - url: http://localhost:3000/api/resume/process
    method: POST
    body:
      multipart:
        files:
          file: ./fixtures/test-resume.pdf
        fields:
          type: "standard"
    expect:
      status: 202
      body:
        json:
          status: "processing"

The files key would map form field names to local file paths. Emberfall would read the file, determine the content type, and attach it as a multipart file part.

Considerations

  • File paths should be relative to the config file location or CWD
  • Content-Type detection could use file extension (.pdf -> application/pdf, .docx -> application/vnd.openxmlformats-officedocument.wordprocessingml.document)
  • Should fail clearly if the referenced file does not exist
  • Depends on Support multipart/form-data request bodies #52 for the base multipart implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions