How about this?

```ruby
def get_connection(middleware = :url_encoded)
    # etc
    f.request middleware
    #etc
end
connection = get_connection :multipart
```