postDocument method
POST's the specified document. An optional path to the document can be specified.
Implementation
Future<dynamic> postDocument(jsonobject.JsonObjectLite<dynamic>? document,
{String? path}) {
if (document == null) {
return _raiseException(WiltException.postDocNoBody);
}
var url = '';
if (path != null) {
url = '$url/$path';
}
// Set the content type for a post
final headers = <String, String>{};
headers['Content-Type'] = 'application/json';
String jsonData;
try {
jsonData = json.encode(document);
} on Exception {
return _raiseException(WiltException.postDocCantStringify);
}
url = _conditionUrl(url);
return _httpRequest(postDocumentt, url, data: jsonData, headers: headers);
}