Skip to content

How do I specify an optional field when accepting multipart-params for a request? #460

Description

@amokfa

Library Version(s)

2.0.0-alpha31

Problem

(POST "/test-route" request
     :multipart-params [optional_data :- s/Str]
     :middleware [admin-rbac upload/wrap-multipart-params]
     (res/ok "ok"))

In this example, optional_data is not a mandatory argument. How do I tell the framework to accept requests which do not provide this field. I've tried these and they don't work:

...
:multipart-params [optional_data :- s/Str nil]
...
...
:multipart-params [optional_data :- (s/maybe s/Str)]
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions