jpsider / RestPS

Simple ReST Framework for Powershell
MIT License
113 stars 30 forks source link

Json Truncated RestPS #76

Closed VictorVanhoorenHogent closed 1 year ago

VictorVanhoorenHogent commented 1 year ago

I'm loving the module so far, but I seem to get a truncated Json response. I assume the RestPs module uses the Convert-To-Json module at the end of the request. The problem is that this module only has a depth of 2 and I need more depth to readout the complete request. How can I achieve this functionality with RestPS?

jpsider commented 1 year ago

I see on line 20 of Invoke-StreamOutput $message = $script:result | ConvertTo-Json

Are you suggesting that we add more depth here? Have you tested this? Are you interested in adding a Pull Request

VictorVanhoorenHogent commented 1 year ago

I think that could be a solution yes.

jpsider commented 1 year ago

Are you able to test this locally and make a pull request? or did you want me to handle that?

VictorVanhoorenHogent commented 1 year ago

I' don't really have a lot of experience with developing PowerShell modules. If you could make the level higher that would help me a lot. In the future you could maybe look at a parameter "level" that can be configured when starting the module.

jpsider commented 1 year ago

Do you have an idea of what the depth should be? Or what do you need it to be to support your current request?

VictorVanhoorenHogent commented 1 year ago

I think 10 would be a good starting point. I might look into contributing to add an extra parameter depth when you start the listener with Start-RestPSListener.

jpsider commented 1 year ago

ok, I will see what I can knock out of the next day or so.

jpsider commented 1 year ago

https://www.powershellgallery.com/packages/RestPS/7.0.54 - has been deployed with a depth of 10. Tested locally and did not seem to impact my basic tests. Let me know if it resolves it for you.

VictorVanhoorenHogent commented 1 year ago

It work fine now, thanks again for creating this wonderful PowerShell module!