Skip to content

Registering fields while running #170

@henrytwo

Description

@henrytwo

Hey @siddhantgoel, thanks for writing this library - this is almost exactly what I've been looking for.

I have an unusual use case where the first part in the request contains the names of the files that we expect to see in the subsequent parts.

I see that registering parts is not allowed while running: https://github.com/siddhantgoel/streaming-form-data/blob/main/src/streaming_form_data/parser.py#L56-L59

But hacking around this by setting _running = True does seem to work from my testing. I understand that this is potentially undefined behaviour, but is there any chance that this this is safe? My thinking is that if I do the registration in the on_finish of the first part, then subsequent parts will be fully registered by the time the parser moves forward.

Alternatively if there is some way for me to register some "catch-all" target and handle it in my own logic that would be great, but it looks like any unregistered chunks just get dropped currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions