Skip to content

setAvatar Rest API gives statuscode null #16110

@rajm

Description

@rajm

Description:

When is access the api/v1/users.setAvatar api end point with credentials in the header and avataUrl and Username in the data, i am getting Statuscode null error

Steps to reproduce:

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://domain/api/v1/users.setAvatar')

http = Net::HTTP.new(uri.host, 443)
http.use_ssl = true

req = Net::HTTP::Post.new(uri.request_uri)
req['X-Auth-Token'] = userAuth
req['X-User-Id'] = userId
req['Content-Type'] = 'application/json'
req.body = {
"username" => @uid,
"avatarUrl" => "imageurl"
}.to_json

@response = http.request(req)
res = JSON.parse(@response.body)

Expected behavior:

{
"success":true
}

Actual behavior:

{
"success": false,
"error": "Cannot read property 'statusCode' of null"
}

Server Setup Information:

  • Version of Rocket.Chat Server: 2.1.0
  • Operating System: ubuntu
  • Deployment Method: docket
  • Number of Running Instances: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions