Skip to content

Empty line added to Batch Request body #285

Closed

Description

@ramanareddy438

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.

Activity

  1. bpreissler commented on Nov 4, 2024

    @bpreissler

    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.

  2. phanak-sap commented on Mar 14, 2025

    @phanak-sap
    Contributor

    Hi @bpreissler

    thx for the investigation. That could be PR directly, sorry, i did not see activity on this issue and that you find the root cause.
    I also misunderstand from the original comment where do you see the problem with one whitespace more than needed - e.g. Content-Type:Xapplication/http instead of Content-Type: application/httpX

    This should be fixed, will do that.

    out of curiosity - what do you mean by " I use an API Gateway where validation fails."? what api gateway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions