Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty line added to Batch Request body #285

Open
ramanareddy438 opened this issue Oct 16, 2024 · 1 comment
Open

Empty line added to Batch Request body #285

ramanareddy438 opened this issue Oct 16, 2024 · 1 comment

Comments

@ramanareddy438
Copy link

ramanareddy438 commented Oct 16, 2024

Hi Team,

I am using pyodata to batch upsert data into SuccessFactors OData API.

batch_req = sf_odata_service.create_batch()
change set = sf_odata_service.create_changeset()

cc_data = {
 "name_en_US": "Test",
 "description_en_US": "Test",
 "startDate": "/Date(-220898800000)/"
}

change_set.add_request(sf_odata_service.entity_sets.FOCostCenter.create_entity().set(**cc_data))

cc_data = {
 "name_en_US": "Dummy",
 "description_en_US": "Dummy",
 "startDate": "/Date(-220898800000)/"
}
change_set.add_request(sf_odata_service.entity_sets.FOCostCenter.create_entity().set(**cc_data))

batch_req.add_request(change_set)

batch_req.execute()

The above code is throwing Missing Boundary delimiter at line '4'.

I printed the body of the request.

--batch_3041_8524_1030
Content-Type: multipart/mixed;boundary=changeset_6522_8586_6718


--changeset_6522_8586_6718
Content-Type: application/http
Content-Transfer-Encoding:binary

POST FOCostCenter HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Requested-With: X

{"startDate": "/Date(-2208988800000)/", "externalCode": "Dummy", "name_en_US": "Dummy", "name_defaultValue": "Dummy", "description_en_US": "", "description_defaultValue": "", "status": "A", "costcenterExternalObjectID": ""}
--changeset_6522_8586_6718
Content-Type: application/http
Content-Transfer-Encoding:binary

POST FOCostCenter HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Requested-With: X

{"startDate": "/Date(1720656000000)/", "externalCode": "Test", "name_en_US": "Test", "name_defaultValue": "Test", "description_en_US": "", "description_defaultValue": "", "status": "A", "costcenterExternalObjectID": ""}
--changeset_6522_8586_6718--
--batch_3041_8524_1030

I see an extra space added after the Content-Type. Not sure where the issue is from myside. Any help is greatly appreciated.

@bpreissler
Copy link

In the file pyodata/v2/service.py in line 46
lines.extend(('Content-Type: application/http ', 'Content-Transfer-Encoding:binary'))
There is an unnecessary space after the Content-Type header. This is I think why there is a space after the content type. When I change that it works for me.
In contrast to your case I use an API Gateway where validation fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants