Comments (3)
@diegomvh Thanks for your fast reply!
I can't find much about the odata standard itself regarding positing binaries, but in another projekt, we used the simple.odata.client in C# where they set a media stream like this:
We have another self hosted odata api where we take the .Media().setStreamAsync() and interpret it like this:
Since this works with the simple.odata.client I believe the standard says PUT on the $value endpoint
I will give your solution a try in a moment :-)
Btw: Is there any way to donate for this project? Since we think about using it in production, we'd love to do that.
Thanks :-)
Update: A colleague sent me this a few seconds ago :
Does any of this help?
Update: Your solution (where we use PUT instead of POST) works, when we push the blob without any form data but with the application/octet-stream header!
from angular-odata.
can you provide some data about de odata standars for posting blobs?, i google'ling for some of that
About your issue, you can allweys use the client with the full http primitives maped to the http client of angular but using resources.
const formData = new FormData();
formData.append("file", file);
const resource = this.client.entitySet<Object>(ENDPOINT).entity(Object.Id).value();
this.client.post(resource, formData);
The resource API tries to map the details of the standard, of course I will try to contemplate the possibility of posting data from the value
resource. But at the moment, don't look too much on the internet about how the standard says what to do.
Thanks to you guys for posting the issue and taking the time to test the library.
from angular-odata.
Hi
Thank you for providing information to see the topic of the media.
One idea is to go back to the implementation of the media resource that the library had at some point, this would be:
# For Entity
this.client.entitySet<Object>(ENDPOINT).entity(Object.Id).media().fetchBlob().pipe(....)
# For Navigation
this.client.entitySet<Object>(ENDPOINT).entity(Object.Id).navigationProperty<Property>("Property").media().fetchBlob().pipe(....)
Unfortunately I find it difficult to find more information on the internet about how to implement the PUT
and that it conforms to the standard, I don't quite understand if it is the correct way and how the implementation of server to receive the request.
I'm going to try something this way: "...we use PUT instead of POST) works, when we push the blob without any form data but with the application/octet-stream header!"
Could you please provide me with the call code using the client? Was it just writing the blob with the "application/octet-stream" header?
To start I see to create the media resource, I hope you can help me with the tests, I do not have the reception of streams implemented in my backend.
Thank you very much and I hope my request is not annoying.
Update: Did you try the mime type in the blob?
https://github.com/angular/angular/blob/e2aa7652e5270e2a0c825ee2f0dde8e307a3b959/packages/common/http/src/request.ts#L319
from angular-odata.
Related Issues (20)
- How expensive is creating an oDataServiceFactory. Can it be stored in a singelton? HOT 4
- Updated - Clone? Filter? Select? HOT 6
- '"angular-odata"' has no exported member named 'ODataFunctionOptions'. Did you mean 'ODataEntityOptions'?
- Angular 14 Support? HOT 1
- publish angular 14 update :-)
- Would like library replace single quote in Odata query by default HOT 1
- how to /(S(juqvmnem2qpijynyewk4pld5))/People('russellwhyte')?$expand=Trips($top=2;$skip=1) HOT 2
- "this.options.helper.context is not a function" HOT 1
- how to access all properties in raw json reply HOT 4
- skiptoken of annotations returns wrong result when it include - (hyphen) HOT 1
- No easy way to provide config asynchronously HOT 2
- Custom entity update endpoint address HOT 1
- Broken .exec method since update to 0.121? HOT 2
- Inline annotations support for parsing metadata xml documents?
- Semicolons should be encoded as %3B ? HOT 2
- replacement of OdataEntityService.customCollectionAction in the latest version HOT 1
- How to perform deep filtering HOT 2
- could you please explain why the preferred http method is PUT but not PATCH HOT 1
- Introduce `provideODataClient()` for standalone Angular apps HOT 7
- `query.orderBy()` usage HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-odata.