Code Monkey home page Code Monkey logo

Comments (2)

alzimmermsft avatar alzimmermsft commented on August 19, 2024

Thanks for reporting this ask Weidong.

I'm actually going to push back against this request from the Core perspective as in this case the path and query parameter annotations state the passed value is already encoded. Which if we try to encode again, we may run into double encoding issues which are just as nebulous, if not worse because they'll always be valid but would result in possible corruption / requests that aren't doing what is expected.

Or to state it more bluntly, I'd rather throw a very explicit error than try to work and maybe work correctly. But, I'd be happy to add in utility methods that could be called to handle these scenarios.

from azure-sdk-for-java.

weidongxu-microsoft avatar weidongxu-microsoft commented on August 19, 2024

Sure, we probably keep the issue for some time for more discussion.

Here the ask is only encode invalid character that never could happen to URL (it is hard for me to find the full list of such characters explicitly, but I guess "space" is one of them). So e.g. %20 won't be encoded again.

I am OK if we decide to do the encoding either in emitted code directly, or via calling a helper method.

One argument for doing this in core, is that if the completed URL (pieced together from RestProxy) have invalid character, the request guaranteed to fail. And some 3rd-party http client (e.g. Python's) does "fix" these invalid character.
Of course, the alternative of "throw an Error" or "let the underlying Http Client handle it" also make sense.

from azure-sdk-for-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.