Skip to content

Commit afe6355

Browse files
committed
Add options to documents#create as well
1 parent ce80fe3 commit afe6355

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/typesense/documents.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def initialize(collection_name, api_call)
1212
@documents = {}
1313
end
1414

15-
def create(document)
16-
@api_call.post(endpoint_path, document)
15+
def create(document, options = {})
16+
@api_call.post(endpoint_path, document, options)
1717
end
1818

1919
def upsert(document, options = {})

spec/typesense/documents_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@
4949
headers: {
5050
'X-Typesense-Api-Key' => typesense.configuration.api_key,
5151
'Content-Type' => 'application/json'
52+
},
53+
query: {
54+
'dirty_values' => 'coerce_or_reject'
5255
})
5356
.to_return(status: 200, body: JSON.dump(document), headers: { 'Content-Type': 'application/json' })
5457

55-
result = companies_documents.create(document)
58+
result = companies_documents.create(document, dirty_values: 'coerce_or_reject')
5659

5760
expect(result).to eq(document)
5861
end

0 commit comments

Comments
 (0)