Convert each data frame row to httr body parameter list without enumeration
<p>So, I have a data frame that carries a bunch of values for two form fields. I want to make POST requests per row as follows:</p>

<pre><code>df &lt;- data.frame(x = 1:5, y = 1:5)
apply(df, 1, function(x) {
       POST(someURL, accept_json(),
            add_headers('Content-Type' = 'application/json'),
            body = list('x' = x[1], 'y' = x[2]), encode = 'json'))
       })
</code></pre>

<p>This works fine. However, is there a way to generate <code>list('x' = x[1], 'y' = x[2])</code> programmatically without enumerating each value like that since the names of the columns in the data frame are basically the list.</p>