Forum Discussion

xjesu's avatar
xjesu
Occasional Visitor
5 years ago

HTTP code of DefaultService result

I point in swagger.yaml that the /chat/ path may return both 200(posted) and 403(banned) HTTP codes. How can I return 403 code from js generated by Swagger?

/**
 * Chat with others
 *
 * roomId String 
 * message String 
 * key String 
 **/
exports.chat = function(roomId,message,key) {
  return new Promice(resolve, reject) {
    if (IsValid(key)) {
      resolve({}); // server answers 200/OK with JSON
    } else {
      ??? // need answer 403/Forbidden
    }
  }
}

 

No RepliesBe the first to reply