-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP Cache support to http_ng #357
Conversation
Generated by 🚫 Danger |
@@ -87,7 +87,7 @@ http.method = function(method, client) | |||
local req_params = get_request_params(method, client, url, options) | |||
local req = http.request.new(req_params) | |||
|
|||
return client.backend.send(req) | |||
return client.backend:send(req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference between :
and .
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah! :
is syntactic sugar for passing self.
So these are the same code:
object:method(param)
object.method(object, param)
This works in the function definition too:
function _M.method(self, param)
end
function _M:method(param)
end
Passing self
It is the only way how a function can know about the object being called on. Like instance method. Otherwise it does not really have any state other than a closure.
* ability to use tables that serialize * properly normalize ETag * spec
Using
Cache-Control: private
the http clientshould be able to cache responses and use the cache
on repeated calls
Good read: https://tools.ietf.org/html/rfc7234
You can use it like: