Populating dropdown options/values via call to local API (was "Adding `Accept` or other headers to httpGet()")

This other answer put me on the right path:

app.on('sessionOpened',  (data, client) => {
  axios.get('http://localhost:8889/transits')
    .then(function (response) {
      receive('/EDIT', 'transit-choices', {"values": response.data}, {clientId: client.id})
    })
    .catch(function (error) {
      console.log(`getTransits error: ${error}`);
    })
})

response.data is a simple array of filenames, e.g., ["file_1", "file_2", …, "file_n"].

1 Like