Giter Site home page Giter Site logo

hack-http-request-response-interfaces's People

Contributors

andrewcarteruk avatar creocoder avatar cxj avatar easy-system avatar evert avatar fredemmott avatar garoevans avatar geekwright avatar grahamcampbell avatar graste avatar jjergus avatar lexidor avatar localheinz avatar maks3w avatar michaelcullum avatar mindplay-dk avatar mouhamed avatar philsturgeon avatar sagikazarmark avatar siwinski avatar usox avatar weierophinney avatar ytake avatar yurybandarchuk16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hack-http-request-response-interfaces's Issues

URIInterface: type mismatch between getUserInfo() and withUserInfo()

  • withUserInfo() takes string $user, ?string $password
  • getUserInfo() always returns string

Options include:

  • making getUserInfo() return ?(string, ?string)
  • making getUserInfo() return ?shape('user' => string, 'pass' => ?string)
  • separate getters for user and password (inconsistent with everything else, but nice for typing)

RequestInterface: withUri() preserveHost parameter

withUri takes a new UriInterface and a bool preserveHost parameter. We generally consider bool parameters to be a code smell, as they harm readability.

Options include:

  • splitting it to separate methods
  • replacing it with an options shape
  • always taking the provided URI verbatim and entirely replacing the previous URI

Re-evalualate nullable stuff in URIs

cc @usox

I don't think we should return ?string where there is not an observerable difference between not provided and empty when using HTTP, or in the string representation of URIs

For example, getRawQuery() - does "/foo" have a different rawquery to "/foo?"? Is the answer the same if we're looking at the current URI and it was a request to one of those?

RequestInterface: getRequestTarget() and withRequestTarget() are untyped

  • getRequestTarget() is documented as returning a string, however this isn't the case if withRequestTarget() is called, which explicitly allows an implementation-defined object.

Options include:

  • make it a generic
  • only allow strings; implementations can add an additional method that isn't in the interface if they wish

Dependency error via Composer

I am running HHVM version 3.29

Problem 1
    - The requested package facebook/hack-http-request-response-interfaces ^0.1 exists as facebook/hack-http-request-response-interfaces[dev-master] but these are rejected by your constraint.

Composer package not found in ^0.1.

Packagist / Latest Version b83a106
Github / Latest Version 5baf46d
does not match git commit hashes

StreamInterface::getMetadata() is untyped

The type depends on whether a key was provided. Options include:

  • never taking a key
  • splitting it to two functions - one returning a dict, one returning mixed

This matters more for Hack as Hack dissallows indexing mixed values.

Explicit support for Set-Cookie header

Not sure that this actually should be here, but we should put some more thought into it.

We could provide basically an equivalent of the setcookie() function, setting extra parameters. This is what I expected to see.

However, perhaps we should leave it to implementations to provide (on top of withHeaderLine) in the way they see fit.

UriInterface comment return type and actual return type are inconsistent.

Several functions' comments in UriInterface state that the return type is null|string, but the declared return type in the signature is a non-nullable string. Are the comments wrong, or should the functions return a nullable string?

Examples:

* @return null|string The URI scheme.
*/
public function getScheme(): string;

* @return null|string The URI authority, in "[user-info@]host[:port]" format.
*/
public function getAuthority(): string;

* @return null|string The URI host.
*/
public function getHost(): string;

* @return null|string The percent-encoded query string
*/
public function getRawQuery(): string;

ServerRequestInterface::getParsedBody() is untyped

There's lot of explicitly implementation-defined behavior here. I don't think there's a good option other than to remove it, and add a new function explicitly for application/x-www-form-urlencoded data that always returns dict<string, string>, or null/throw an exception if not form-urlencoded

Implementation-specific behavior can be added to concrete classes without defining it in the interface.

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.