Fix webmock integration when posting tempfiles

The fix is two-fold and also allows them to be retryable.

Closes #320 (closed)

I looked for a bit of context on why these are closed in the first place and think this explains it !113 (merged):

A problem waiting to happen with http-form_data is that the parts never close, i.e.: a file descriptor will open when uploading a file via HTTP::File, annd will never close. So we have to do better there.

https://github.com/httprb/form_data/issues/27 oh well.

This is not necessary for all tempfiles or files opened with a block but I don't think there is a mechanism to inquire if a file will autoclose 🤷


Now, the added tests would pass if it weren't for rbs:

1) Error:
WebmockTest#test_verification_tath_expected_request_occured_with_form_tempfile:
RuntimeError: Neutered Exception RBS::Test::Tester::TypeError: TypeError: [HTTPX::Transcoder::Multipart::Part.call] UnresolvedOverloadingError: couldn't find a suitable overloading

I tried modifying the definition file but couldn't figure it out. I guess it would need to be somewhere here https://gitlab.com/Earlopain/httpx/-/blob/91b9e13cd07247609d8504409c7c3628e8279ece/sig/transcoder/multipart.rbs#L86 but even just adding a different case for Tempfile didn't do it.

Merge request reports

Loading