Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

http/request_method.fz


# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation.  If not, see <https://www.gnu.org/licenses/>.


# -----------------------------------------------------------------------
#
#  Tokiwa Software GmbH, Germany
#
#  Source code of Fuzion standard library feature request_method
#
# -----------------------------------------------------------------------


# HTTP request method GET
public get is

# HTTP request method HEAD
public head is

# HTTP request method POST
public post_r is

# HTTP request method PUT
public put is

# HTTP request method DELETE
public delete is

# HTTP request method CONNECT
public connect is

# HTTP request method OPTIONS
public options is

# HTTP request method TRACE
public trace is

# HTTP request method PATCH
public patch is # NYI: is this part of HTTP 1.1

# HTTP request method
public request_method : choice http.get http.head http.post_r http.put http.delete
                               http.connect http.options http.trace http.patch, property.equatable is

  public fixed redef type.equality(a, b http.request_method) bool =>
    match a
      http.get     => b ? http.get     => true | * => false
      http.head    => b ? http.head    => true | * => false
      http.post_r  => b ? http.post_r  => true | * => false
      http.put     => b ? http.put     => true | * => false
      http.delete  => b ? http.delete  => true | * => false
      http.connect => b ? http.connect => true | * => false
      http.options => b ? http.options => true | * => false
      http.trace   => b ? http.trace   => true | * => false
      http.patch   => b ? http.patch   => true | * => false

  public redef as_string String =>
    match request_method.this
      http.get     => "GET"
      http.head    => "HEAD"
      http.post_r  => "POST"
      http.put     => "PUT"
      http.delete  => "DELETE"
      http.connect => "CONNECT"
      http.options => "OPTIONS"
      http.trace   => "TRACE"
      http.patch   => "PATCH"

last changed: 2026-06-12