import { TwilioResponse } from "@twilio-labs/serverless-runtime-types/types"

/**
 * Fill a twilio response object with JSON and set the appropriate headers
 * @param response 
 * @param statusCode 
 * @param json 
 * @returns twilio response
 */
export const setResponseJson = (response: TwilioResponse, statusCode: number, json: any): TwilioResponse => {
  response
    .setStatusCode(statusCode)
    .appendHeader('Content-Type', 'application/json')
    .setBody(json);

  return response;
}
