hhvm / hack-http-request-response-interfaces Goto Github PK
View Code? Open in Web Editor NEWDefines common cross-framework interfaces to represent HTTP requests and responses
License: MIT License
Defines common cross-framework interfaces to represent HTTP requests and responses
License: MIT License
withUserInfo()
takes string $user, ?string $password
getUserInfo()
always returns string
Options include:
getUserInfo()
return ?(string, ?string)
getUserInfo()
return ?shape('user' => string, 'pass' => ?string)
Currently, most accessors are defined as returning empty strings - however, this is mildly inconsistent with getPort() and withPort(), which deal with ?int
.
It could be safer to rename it to withRawQuery (+ getRawQuery()), and make withQuery take dict<string, ?string>
and require implementations to encode/escape, instead of application developers.
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:
They currently accept either a single value or an array of values. Either we should only allow one case, or we should split it into two.
Currently defiend in terms of $_FILES and PHP's UPLOAD_ERR_XXX constants
For example:
Options include:
Support for implicit coercions seems unnecessary.
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?
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:
This is a meta issue to track the rework that should be done for these interfaces and the problems they have;
Options include:
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
The type depends on whether a key was provided. Options include:
This matters more for Hack as Hack dissallows indexing mixed values.
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.
Should replace it with a more specific encoding - e.g. 'dots replaced with underscores''
They're untyped as they return an arbitrarily nested tree.
Options include:
dict<string, Node>
where Node may be a Leaf or another object containing dict<string, Node>
resources are not type-safe and are a PHPIsm. Some options are:
My instinct would be both (1) and (3)
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:
hack-http-request-response-interfaces/src/UriInterface.hack
Lines 64 to 66 in ab9e095
hack-http-request-response-interfaces/src/UriInterface.hack
Lines 83 to 85 in ab9e095
hack-http-request-response-interfaces/src/UriInterface.hack
Lines 106 to 108 in ab9e095
hack-http-request-response-interfaces/src/UriInterface.hack
Lines 172 to 174 in ab9e095
refs #27
For example, if I call ->withHeader('foo', vec['bar'])
and ->withHeader('Foo', vec['baz'])
, what exactly goes down the wire?
bar
closes #36
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.