Add Flatbuffers support to NodeJS bindings
This commit is contained in:
parent
c2da4c33fc
commit
e45fb31a92
@ -964,10 +964,17 @@ inline PluginParameters argumentsToPluginParameters(
|
||||
}
|
||||
return {false};
|
||||
}
|
||||
else if (format_str == "buffer" || format_str == "json_buffer")
|
||||
else if (format_str == "buffer")
|
||||
{
|
||||
return {true};
|
||||
}
|
||||
else if (format_str == "json_buffer")
|
||||
{
|
||||
if (output_format && output_format != osrm::engine::api::BaseParameters::OutputFormatType::JSON) {
|
||||
Nan::ThrowError("Deprecated `json_buffer` can only be used with JSON format");
|
||||
}
|
||||
return {true};
|
||||
}
|
||||
else
|
||||
{
|
||||
Nan::ThrowError("format must be a string: \"object\" or \"buffer\"");
|
||||
|
||||
@ -35,7 +35,7 @@ test('route: routes Monaco and can return result in flatbuffers if output format
|
||||
});
|
||||
});
|
||||
|
||||
test('route: throws error if required output in object in flatbuffers format', function(assert) {
|
||||
test('route: throws error if required output is object in flatbuffers format', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM(monaco_path);
|
||||
assert.throws(function() {
|
||||
@ -43,6 +43,14 @@ test('route: throws error if required output in object in flatbuffers format', f
|
||||
});
|
||||
});
|
||||
|
||||
test('route: throws error if required output is json_buffer in flatbuffers format', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM(monaco_path);
|
||||
assert.throws(function() {
|
||||
osrm.route({coordinates: two_test_coordinates, format: 'flatbuffers'}, {format: 'json_buffer'}, function(err, result) {});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
test('route: routes Monaco', function(assert) {
|
||||
assert.plan(5);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user