Comments (11)
I'm having the same issues:
error TS2554: Expected 0-1 arguments, but got 2.
error TS2339: Property 'parsedBody' does not exist on type 'HttpOperationResponse'.
any solution yet?
from autorest.typescript.
bodyAsJson
was renamed to parsedBody
in ms-rest-js and we recently updated the AutoRest generator to use this new name. The best solution is to use the latest ms-rest-js. Sorry for the inconvenience.
from autorest.typescript.
This has been fixed in the most recent preview versions of ms-rest-js
and autorest.typescript
.
from autorest.typescript.
@daschult I am still encountering runtime errors with parsedBody
. It always returns undefined
even though bodyAsText
is has valid json. Can you provide an example of the working cli command to run?
from autorest.typescript.
@clouddra If you use the following line on the command line:
autorest --typescript [email protected]/autorest.typescript@preview <the rest of your command>
then it will use the latest preview version of the AutoRest TypeScript generator. If you're not using the --generate-metadata
command line argument, then you'll also need to go into your package.json file and update your ms-rest-js
dependency to use the latest preview version as well (0.7.206 as of this comment).
from autorest.typescript.
yes the property exists for me but it always return undefined
. Is it unable to parse the response text?
from autorest.typescript.
If you look in the generated operation, e.g. getWithHttpOperationResponse(), do you see parsedBody being set in the code?
from autorest.typescript.
parsedBody
is not set. bodyAsText
is set though.
from autorest.typescript.
I would try forcing using the latest generator and runtime with [email protected]/autorest.typescript@preview
in autorest and npm i ms-rest-js@preview
in your package.
from autorest.typescript.
I see this if the REST API doesn't set the content-type to "application/json". In my case it was “application/octet-stream”, which causes the AutoRest generated code to not parse the content as json into the parsedBody property.
from autorest.typescript.
We might be able to do something like prefer the Content-Type given in "produces"
in Swagger to the Content-Type we see at runtime. Do you mind opening an issue for this?
from autorest.typescript.
Related Issues (20)
- Test error in payload-content-negotiation when add rlc in cadl-ranch HOT 2
- Serialization Incomplete For Polymorphic Input HOT 6
- Generate code error for unions when add rls coverages in cadl-ranch
- Support model inheritance and polymorphism in Modular HOT 2
- Enum not getting generated by typespec-ts emitter
- Inconsistent path between test file and mockapi.ts for encodeBytes HOT 1
- [Codegen/TypeSpec] Handle apiVersion as Path Parameter HOT 20
- [Codegen/TypeSpec] missing error response import in source code HOT 1
- Type declaration is missing when update rlc for property-value-types in cadl-ranch HOT 1
- Support decimal type from typespec HOT 6
- Missing return type annotation on getClient function in classic/client/.../index.ts HOT 1
- [TypeSpec] Support @flattenProperty
- Implement Modular for new LRO support
- upgrade deprecated dependencies HOT 4
- Support json + bytes type in multipart/form-data in RLC
- We should not use the Boolean value of 'branded' to decide branding/non-branding
- Handle `bytes` differently according to content type in RLC
- Fix issues when integrating string + bytes multipart case in cadl-ranch
- [Epic] Support multipart & form data from e2e in RLC
- Form data policy is not working in browser environment
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 autorest.typescript.