Skip to content
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

Added convenient shortcut for HEAD #2

Merged
merged 1 commit into from Dec 6, 2014

Conversation

dahankzter
Copy link
Contributor

I just thought it would be nice to be able to write r.HEAD.

I am not sure if my little change is correct wrt the underlying aech but it seems to work.

@dahankzter
Copy link
Contributor Author

Is it possible for you to take this? It is not crucial of course but nice to have the corresponding HTTP methods. I guess OPTIONS and TRACE could be added although CONNECT seems far fetched.

@julienschmidt
Copy link
Owner

I'm not sure whether more shortcuts like this should be added or not.

On the one hand this is not much code and does not really bloat the package. Moreover it could make the code a bit more consistent for some users, since they don't need to use r.Handle("HEAD", path, handle) and so on for some routes, while using shortcuts like r.GET(path, handle) for all other routes.

On the other hand the shortcuts are meant for really often used request methods only. I think that would be the 5 currently included ones. Where should we draw the line, if we also add a shortcut for HEAD? Then OPTIONS would also be a must, I think.

I'd appreciate comments from any other user of this packages (Hello, repository watchers 😉 ).
How do you use this package? Do you use request methods like HEAD and OPTIONS a lot?

@dahankzter
Copy link
Contributor Author

Personally I would of course like to add HEAD since I tend to use it at least from time to time when it makes sense.

OPTIONS however I have never used nor even seen used in any project. It could be added for completeness but other than that I don't think there is a compelling reason to add OPTIONS.

@dahankzter
Copy link
Contributor Author

You didn't take it? It was very little code for a nice symmetry in the operations.

@mark-kubacki
Copy link

OPTIONS is used with CORS: http://www.w3.org/TR/cors/

Stichwort „Access-Control-Allow-Origin“ ;-)

@dahankzter
Copy link
Contributor Author

Ah interesting! :)

@julienschmidt julienschmidt reopened this Oct 13, 2014
This was referenced Oct 13, 2014
@julienschmidt julienschmidt merged commit 62d716e into julienschmidt:master Dec 6, 2014
similark pushed a commit to similarweb/httprouter that referenced this pull request May 9, 2023
* starting the scaler and interceptor

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Adding interceptor

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* link to issue

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* operator and CLI start

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* starting on the dockerfiles

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Improving the operator Dockerfile

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fix

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* note

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding go based operator

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* a bit of progress

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* moving rust operator to old

will delete this shortly

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* moving goperator to operator

forgot to do this last commit

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* moving go.mod to root

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* marking deprecated

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* it builds
gs

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* progress on the operator

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more progress

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* All my changes and implementations (julienschmidt#2)

* Fix error with existing variable

* Rename ScaledObject to HTTPScaledObject

* Add draft implementation for status spec

* Rename files to match new naming

* Remove scaffolding comments

* Change requeue time to 50s

* Variable renaming to better read

* Add new spec field to make polling configurable

* Remove previously added objects in case of error

* Set Statuses

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Fix Typos (julienschmidt#4)

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Add RBAC rules for services, pods and deployments (julienschmidt#5)

* Fix Typos

* Add RBAC rules for services, pods and deployments

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Bunch of changes (julienschmidt#6)

* Fix Typos

* Implement object deletion

* Add prefix for logging

* Remove unused status interface

* Add status check for "Ready"

* Golint

* Generate CRD Manifests

* Reorder RBAC Roles

* Change file namings

* Remove CLI part for now

* Add internal build context for operator

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Charts, docs, readability and other changes (julienschmidt#8)

* Fix Typos

* Implement object deletion

* Add prefix for logging

* Remove unused status interface

* Add status check for "Ready"

* Golint

* Generate CRD Manifests

* Reorder RBAC Roles

* Change file namings

* Remove CLI part for now

* Add internal build context for operator

* Remove Rust-related things

* Add comment docs and reorder packages

* Change variable name and add package docs

* Add package docs

* Add package docs

* Rename var for readability

* Adds package docs

* Remove commented code

* Remove unused admin echo server and rename current one

* Add more logging and docs

* Fix doc

* Update readme on cli

* Add scaffold to operator chart

* Add docs

* Golint

* Update name in kustomization

* Add descriptions to fields

* Update default image name

* Change resource names

* Add version tag to kustomization

* Add make command for charts

* Create base values file

* Add patch for image name

* Add environment variable to manager

* Update charts/operator/Chart.yaml

Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>

* Update charts/operator/Chart.yaml

Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>

* Correct dir name and reuse step

* Rename dir to keda-http-operator

* Add envs to deployment pkg

* Add new statuses for extended objetct

* Fixing interceptor listening port

* Include new "Terminating" status

* Add namespaces for logs

* Change variable names

* Add new statuses

* Code reorder

* Create interceptor

* Add missing return

* Remove comment

* Fix link

* Remove all references to external scaler address

This is because we'll use one external scaler for each new application, so there's no point in having a single environment variable controlling the
address of the external scaler.

The address will be defined by the operator for each new app and a new scaler will be created.

* Fixing external scaler port

* Code reorder and creation of external scaler

* Improve code readability

* Golint

* Add colons

* Further clean the code

* Move functions to other file

* Rename files

* Add more meaninful names

* Rename method

* Update roles and enums

* Make yamls

* Add next TODO

* Add todo

Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Fixing the operator Dockerfile

also adding env vars to allow users to customize docker image names

Fixes kedacore/http-add-on#5

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Updating to the KEDA 2.0 external scaler gRPC interface

The notable change here is that there is an added StreamIsActive
RPC call. The New and Close RPCs are removed.

Fixes kedacore/http-add-on#3

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Making the scaler talk to interceptors to get pending HTTP queue sizes

Fixes kedacore/http-add-on#4

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Initial install docs

Includes various tweaks needed to make install work

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more progress

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* proper port and path

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* splitting up helm chart

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fix chart, example yaml, and fix panic in operator logging

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fixing log errors

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* minor changes

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* gracefully moving on when deleting kube resources

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* creating dynamic client

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* using proper group for scaled objects

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding scaledobject to ClusterRole

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Helm installation in the Makefile

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more loggign

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* properly specifying namespaces etc...

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* setting operator deployment pull policy to always

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding more logs to resource creation

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fixing namespace problems and simplifying code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* proper API version

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* aking image names and ports for external scaler and interceptor configurable

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding docs

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* proper env var names

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Specifying proper external scaler ports

Also moving the application config in the operator into operator/config

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* ports

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* updated ScaledObject spec

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* proper port formatting for interceptor

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more logging and not requeueing

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* cscaler => kedahttp

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* trying something out

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding finalizer, simplifying get code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* finalizers

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* ignoring more stuff

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing the right things

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* updating deletion & error logic

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* logging status updates

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* check for already exists inside specific creator logic

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Fiddling with status

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* upgrading CRD version

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Adding instructions on microk8s installs

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Restoring the status file

Don't know why I deleted it in arschles/http-add-on@021b5f1

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* myapp => xkcd

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* service type

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* logging

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* configuring services properly

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* readme

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

Co-authored-by: Lucas Santos <lhs.santoss@gmail.com>
Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>
romankarpowich pushed a commit to romankarpowich/httprouter that referenced this pull request May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants