Skip to content

`change-available-send-storage` doesn't work with Nu's `http post`

Description

Nu's http post does not accept integer values for its http body. But the Rust code actually expects a usize, meaning we should be sending an int. This is with Nu 0.95.0 The following do not work( new_storage_space is an int:

  • $"change-available-send-storage" | run-command $node --post-body $new_storage_space
  • $"change-available-send-storage" | run-command $node --post-body $'($new_storage_space)'
  • $"change-available-send-storage" | run-command $node --post-body $'"($new_storage_space)"'
  • $"change-available-send-storage" | run-command $node --post-body $"($new_storage_space)"
  • $"change-available-send-storage" | run-command $node --post-body [$new_storage_space]
  • $"change-available-send-storage" | run-command $node --post-body $'["value": ($new_storage_space)]'
  • $"change-available-send-storage" | run-command $node --post-body ["value": ($new_storage_space)]

Having tested all the options I could think of, just giving the integer returns:

Error: nu::shell::io_error

  × I/O error
  help: unsupported body input

But if we do it with cURL:

curl -X POST "http://127.0.0.1:3001/change-available-send-storage" -H "Content-Type: Application/Json" -d $'10000000000'

it works

Solutions

  • Make this a GET
  • Use cURL
  • Wait for Nu's http post to accept int as body

Note that this might already be solved in a newer version of Nu

Edited by DISSOUBRAY Nathan