SymphonyPlatformSolutions / symphony-api-client-node

Symphony API Client for NodeJS
MIT License
6 stars 20 forks source link

addMemberToRoom returning 415 Unsupported Media Type #22

Closed karlmoll closed 5 years ago

karlmoll commented 5 years ago

After logging the request sent, and the header is being forced to be ’text/html’. It looks like the method is sending a form instead of application/json from JSON.stringify(body), but not positive.

<!doctype html>HTTP Status 415 \'96 Unsupported Media Type

HTTP Status 415 \'96 Unsupported Media Type


Type Status Report

Message Unsupported Media Type

Description The origin server is refusing to service the request because the payload is in a form\ \

miguel-symphony commented 5 years ago

Problem looks like the headers are not being sent correctly in the request options. line 282

var options = {
    'hostname': SymConfigLoader.SymConfig.podHost,
    'port': SymConfigLoader.SymConfig.podPort,
    'path': '/pod/v1/room/' + streamId + '/membership/add',
    'method': 'POST',
    'Content-Type': 'application/json',
    'headers': {
      'sessionToken': SymBotAuth.sessionAuthToken
    },
    'agent': SymConfigLoader.SymConfig.proxy
  }

Content-Type should be inside headers This problem may appear in a few other places in StreamsClient/index.js as well

getUserIMStreamId
removeMemberFromRoom
promoteUserToOwner
demoteUserFromOwner
searchRooms
getUserStreams
mistryvinay commented 5 years ago

@karlmoll / @miguel-symphony thank you for reporting this issue and identifying the problem. Updates now included in the latest repo. Thanks again.