postDocumentString method

Future postDocumentString(
  1. String? document, {
  2. String? path,
})

POST's to the specified document where the document is supplied as a json string. Must be used if '_id' and or '_rev' are needed.

Implementation

Future<dynamic> postDocumentString(String? document, {String? path}) {
  if (document == null) {
    return _raiseException(WiltException.postDocStringNoBody);
  }

  var url = '';
  if (path != null) {
    url = '$url/$path';
  }

  // Set the content type for a post
  final headers = <String, String>{};
  headers['Content-Type'] = 'application/json';

  url = _conditionUrl(url);
  return _httpRequest('POST_DOCUMENT_STRING', url,
      data: document, headers: headers);
}