import { r as registerInstance } from './index-cb74209c.js';

const RestController = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  /**
   * Makes a request to a features REST API. It resolves to the server
   * response object.
   * @param feature GeoJSON feature to be sent to the API.
   * @param options Options object.
   */
  async create(feature, options) {
    let headers = {};
    headers["Content-Type"] = "application/json";
    if (options.token != undefined)
      headers["Authorization"] = "Bearer " + options.token;
    return await fetch(options.url, {
      body: options.method === "GET" ? undefined : JSON.stringify(feature),
      headers: headers,
      method: options.method || "POST",
      mode: options.mode || "cors",
    });
  }
};

export { RestController as gl_rest_controller };

//# sourceMappingURL=gl-rest-controller.entry.js.map