init method

Future<WebRequest> init()

Initializes the request by setting response headers and parsing data.

Returns the WebRequest instance after initialization.

Implementation

Future<WebRequest> init() async {
  _rq.response.headers.add('Access-Control-Allow-Origin', "*");
  _rq.response.headers.add(
    'Access-Control-Allow-Methods',
    'GET,HEAD,OPTIONS,POST,PUT,DELETE',
  );
  _rq.response.headers.add('Access-Control-Allow-Headers',
      'Origin, X-Requested-With, Content-Type, Accept, x-client-key, x-client-token, x-client-secret, Authorization');
  _rq.response.headers.add('Access-Control-Allow-Credentials', 'true');

  await parseData();
  return this;
}