2

I have a http.put/post call triggered by metadata change on a liquidsoap 1.4.2 source:

def m_meta(m) =
  d = json_of(m)
  ignore(http.post(headers=[("Conent-Type","application/json; charset=utf-8"),("authorization","KEY"),("accepts","application/json")], data="#{d}", "/api/soundscapeplaylists"))
end

The call triggers as expected, and hits the api, but the only data i get is the id of the new post.

I've dumped the data to the terminal and entered it manually (through swagger), and all works fine, but when sent from liquidsoap i get no data.

Any help would be appreciated.

Russ_ell
  • 53
  • 1
  • 7

1 Answers1

2

Maybe it's related to the typo in your headers:

"Conent-Type","application/json; charset=utf-8"

You are missing the "t" for "Content-Type":

"Content-Type","application/json; charset=utf-8"

Update: After testing it for myself, I confirm having the same issue (Liquidsoap 1.4.3). I also ended up solving it with a CURL call:

ignore(system("curl -X POST -H 'Content-Type: application/json' --data '#{json_data}' localhost:1337"))
david
  • 2,529
  • 1
  • 34
  • 50