How to change status code of headers of response?

I want to response personal defined statuscode and some headers.
But I find even I change the status code to 201 the status code is still 200. and my defined header is not in headers.

my handler like:

function createResponse(status, header, body) {
  return {
    headers: Object.assign(header, {
      'Access-Control-Allow-Origin': '*',
      'Content-Type': 'application/json;charset=utf-8'
    }),
    statusCode: status,
    body: JSON.stringify(body)
  }
}
export const hello = async (event, context, cb) => { 
  const rep = {
      message: 'v1.0',
      event: event
  };
  cb(null, createResponse(201, {}, rep));
  return;
};

How to check to correct code can change status code and response header?

Try returning the result from your createResponse() call instead of using the callback parameter as it’s not officially part of the async handler syntax.

function createResponse(status, header, body) {
  return {
    headers: Object.assign(header, {
      'Access-Control-Allow-Origin': '*',
      'Content-Type': 'application/json;charset=utf-8'
    }),
    statusCode: status,
    body: JSON.stringify(body)
  }
}
export const hello = async (event, context) => { 
  const rep = {
      message: 'v1.0',
      event: event
  };
  return createResponse(201, {}, rep);
};