Git Product home page Git Product logo

simplerestservices's People

Contributors

alanquillin avatar sharwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

simplerestservices's Issues

Assembly should have a strong name

The assembly should be signed so it has a strong name. Otherwise, the library will be unusable from other libraries which have strong names.

Connectivity problems can lead to silent failures in RestServiceBase

(I already fixed this issue and will send a pull request shortly)

If a service is unreachable (e.g. network cable unplugged, connection timeout, DNS resolution failure, or proxy problems), the library can "silently" fail.

This issue stems from RestServiceBase catching exceptions that is does not truly handle. Properly preserving the error information for handling at a higher level requires the following changes.

  • RestServiceBase.ExecuteRequest should rethrow a WebException when the Response property is null.
  • RestServiceBase.ExecuteRequest should not attempt to handle exceptions thrown by the callback methods.
  • RestServiceBase.BuildWebResponse should throw an exception if the resp argument is null.
  • RestServiceBase.BuildWebResponse should not hide exceptions thrown when reading the response stream.

Remove or document Server functionality

The server functionality is currently undocumented. It should be documented to improve usability or removed to simplify the library if it is no longer used.

How should `IRetryLogic<T, T2>` behave if the operation fails a final time?

One of the arguments to IRetryLogic<T, T2>.Execute is a retry count. If the call to logic fails and the retry count has reached 0, how should the call to Execute behave?

  • Should it throw an exception, and if so, which one?
  • Should it return a particular value? If so, would it be default(T) or the last (unsuccessful) value returned from logic?

RestServiceBase.Stream does not preserve input position on retry

When RequestSettings.RetryCount is greater than 0, the streaming operation does not reset the input Stream.Position to the original value before retrying the operation. This can lead to data corruption, where a streaming operation completes successfully but did not transfer the full data.

Deserialization exceptions are hidden from calling code

Currently RestServiceBase.BuildWebResponse<T> hides any StringSerializationException that is thrown. These exceptions expose flaws in the calling code's object model, so they should be propagated instead of hidden. The documentation for IRestService needs to be updated to reflect the changes.

RestServiceBase.Stream can read too much data from the input stream

RestServiceBase.Stream does not account for the maxReadLength when making a call to content.Read. When the maxReadLength is less than the length of the stream, and not a multiple of bufferSize, this leaves the stream position at an unexpected offset when the method returns.

retryCount should default to 0

REST calls should not be retried unless a retry is explicitly requested as part of the library usage. In other words, the various retryCount arguments should all default to 0.

This is consistent with the RequestSettings.RetryCount property, which already defaults to 0. Existing user code is extremely unlikely to be affected by this change, because all of the normal entry points to this SDK use a RequestSettings object, which specifies the retry count in the RetryCount property.

UrlBuilder uses HttpEncode instead of UrlEncode

(I already fixed this issue and will send a pull request shortly)

UrlBuilder uses HttpUtility.HtmlEncode for a few things, leading to two problems.

  1. The query string is incorrectly constructed when the value contains certain characters such as a space. The code should use HttpUtility.UrlEncode instead.
  2. Since HttpUtility.HtmlEncode("?") == "?", the duplicate check when selecting a separator is unnecessary.

Assembly versioning is breaking client applications

To ensure that clients are able to reference this project reliably, the assembly versioning needs to be slightly altered.

  1. The Build and Revision fields for the AssemblyVersionAttribute should always be 0. This attribute is used for the strong name of the assembly, so by the definition of these fields as indicating a backwards-compatible assembly they MUST never change.
  2. The Build and Revision fields for the AssemblyFileVersionAttribute should be updated to indicate the actual release version of the assembly, minus any prerelease version suffix (if applicable).
  3. The AssemblyInformationalVersionAttribute should be maintained to indicate the complete version of the assembly, including any prerelease version suffix (if applicable).

Improve visibility of license notice

The license for the project should be more visible to users looking at the assembly information or the project on GitHub. In addition, since there are no exception to the MIT license for files in the SimpleRESTServices.dll assembly, the license notice could make that more clear without requiring users to look at all the individual source files.

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.