Install restclient & Co. (helm and company helpers)

This commit is contained in:
Gergely Polonkai 2016-10-21 15:23:54 +02:00
parent e2b3df969c
commit 0f51e9aa9a
18 changed files with 1817 additions and 0 deletions

View File

@ -0,0 +1,23 @@
;;; company-restclient-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "company-restclient" "company-restclient.el"
;;;;;; (22538 5602 910843 848000))
;;; Generated autoloads from company-restclient.el
(autoload 'company-restclient "company-restclient" "\
`company-mode' completion back-end for `restclient-mode'.
Provide completion info according to COMMAND and ARG. IGNORED, not used.
\(fn COMMAND &optional ARG &rest IGNORED)" t nil)
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; company-restclient-autoloads.el ends here

View File

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "company-restclient" "20151202.401" "company-mode completion back-end for restclient-mode" '((cl-lib "0.5") (company "0.8.0") (emacs "24") (know-your-http-well "0.2.0") (restclient "0.0.0")) :url "https://github.com/iquiw/company-restclient")

View File

@ -0,0 +1,140 @@
;;; company-restclient.el --- company-mode completion back-end for restclient-mode
;; Public domain.
;; Author: Iku Iwasa <iku.iwasa@gmail.com>
;; URL: https://github.com/iquiw/company-restclient
;; Package-Version: 20151202.401
;; Version: 0.2.0
;; Package-Requires: ((cl-lib "0.5") (company "0.8.0") (emacs "24") (know-your-http-well "0.2.0") (restclient "0.0.0"))
;;; Commentary:
;; `company-mode' back-end for `restclient-mode'.
;;
;; It provides auto-completion for HTTP methods and headers in `restclient-mode'.
;; Completion source is given by `know-your-http-well'.
;;; Code:
(require 'cl-lib)
(require 'company)
(require 'know-your-http-well)
(require 'restclient)
(defcustom company-restclient-header-values
'(("content-type" . ("application/json"
"application/xml"
"application/x-www-form-urlencoded"
"text/csv"
"text/html"
"text/plain")))
"Association list of completion candidates for HTTP header values.
The key is header name and the value is list of header values.")
(defvar company-restclient--current-context nil)
(defun company-restclient--find-context ()
"Find context (method, header, body) of the current line."
(save-excursion
(forward-line 0)
(cond
((looking-at-p "^:") 'vardecl)
((looking-at-p "^#") 'comment)
(t
(catch 'result
(let ((state 0))
(while (and (>= (forward-line -1) 0)
(null (looking-at-p "^#")))
(cond
((looking-at-p "^\\([[:space:]]*$\\|:\\)")
(cond
((= state 0) (setq state 1))
((= state 2) (setq state 3))))
((= state 0) (setq state 2))
((or (= state 1) (= state 3))
(throw 'result 'body))))
(if (or (= state 0) (= state 1))
(throw 'result 'method)
(throw 'result 'header))))))))
(defun company-restclient-prefix ()
"Provide completion prefix at the current point."
(cl-case (company-restclient--find-context)
(method (or (let ((case-fold-search nil)) (company-grab "^[[:upper:]]*"))
(company-restclient--grab-var)))
(header (or (company-grab "^[-[:alpha:]]*")
(company-restclient--grab-var)
(company-grab-symbol)))
(vardecl nil)
(comment nil)
(t (company-restclient--grab-var))))
(defun company-restclient--grab-var ()
"Grab variable for completion prefix."
(company-grab ".\\(:[^: \n]*\\)" 1))
(defun company-restclient-candidates (prefix)
"Provide completion candidates for the given PREFIX."
(cond
((string-match-p "^:" prefix)
(setq company-restclient--current-context 'varref)
(all-completions
prefix
(sort (mapcar #'car (restclient-find-vars-before-point)) #'string<)))
(t
(cl-case (setq company-restclient--current-context
(company-restclient--find-context))
(method
(all-completions prefix http-methods))
(header
(cond
((looking-back "^\\([-[:alpha:]]+\\): .*")
(setq company-restclient--current-context 'header-value)
(all-completions prefix
(cdr
(assoc
(downcase (match-string-no-properties 1))
company-restclient-header-values))))
(t
(all-completions (downcase prefix) http-headers))))))))
(defun company-restclient-meta (candidate)
"Return description of CANDIDATE to display as meta information."
(cl-case company-restclient--current-context
(method (cl-caadr (assoc candidate http-methods)))
(header (cl-caadr (assoc candidate http-headers)))))
(defun company-restclient-post-completion (candidate)
"Format CANDIDATE in the buffer according to the current context.
For HTTP method, insert space after it.
For HTTP header, capitalize if necessary and insert colon and space after it."
(cl-case company-restclient--current-context
(method (insert " "))
(header (let (start (end (point)))
(when (save-excursion
(backward-char (length candidate))
(setq start (point))
(let ((case-fold-search nil))
(looking-at-p "[[:upper:]]")))
(delete-region start end)
(insert
(mapconcat 'capitalize (split-string candidate "-") "-"))))
(insert ": "))))
;;;###autoload
(defun company-restclient (command &optional arg &rest ignored)
"`company-mode' completion back-end for `restclient-mode'.
Provide completion info according to COMMAND and ARG. IGNORED, not used."
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend 'company-restclient))
(prefix (and (derived-mode-p 'restclient-mode) (company-restclient-prefix)))
(candidates (company-restclient-candidates arg))
(ignore-case 'keep-prefix)
(meta (company-restclient-meta arg))
(post-completion (company-restclient-post-completion arg))))
(provide 'company-restclient)
;;; company-restclient.el ends here

View File

@ -0,0 +1,138 @@
;;; http-headers.el --- Look up the meaning of HTTP headers
;;
;; This file was automatically generated by
;; https://github.com/for-GET/know-your-http-well
;;
;;; Commentary:
;;; Code goes here:
(defconst http-headers
'(("content-encoding" ("indicates what content codings have been applied to the representation, beyond those inherent in the media type, and thus what decoding mechanisms have to be applied in order to obtain data in the media type referenced by the Content-Type header field."))
("content-language" ("describes the natural language(s) of the intended audience for the representation."))
("content-location" ("references a URI that can be used as an identifier for a specific resource corresponding to the representation in this message's payload."))
("content-type" ("indicates the media type of the associated representation: either the representation enclosed in the message payload or the selected representation, as determined by the message semantics."))
("content-length" ("can provide the anticipated size, as a decimal number of octets, for a potential payload body."))
("content-range" ("is sent in a single part 206 (Partial Content) response to indicate the partial range of the selected representation enclosed as the message payload, sent in each part of a multipart 206 response to indicate the range enclosed within each body part, and sent in 416 (Range Not Satisfiable) responses to provide information about the selected representation."))
("transfer-encoding" ("lists the transfer coding names corresponding to the sequence of transfer codings that have been (or will be) applied to the payload body in order to form the message body."))
("cache-control" ("is used to specify directives for caches along the request/response chain."))
("expect" ("is used to indicate that particular server behaviors are required by the client."))
("host" ("provides the host and port information from the target URI, enabling the origin server to distinguish among resources while servicing requests for multiple host names on a single IP address."))
("max-forwards" ("provides a mechanism with the TRACE and OPTIONS methods to limit the number of times that the request is forwarded by proxies."))
("pragma" ("allows backwards compatibility with HTTP/1.0 caches, so that clients can specify a no-cache request that they will understand (as Cache-Control was not defined until HTTP/1.1)."))
("range" ("modifies the method semantics to request transfer of only one or more subranges of the selected representation data, rather than the entire selected representation data."))
("te" ("indicates what transfer codings, besides chunked, the client is willing to accept in response, and whether or not the client is willing to accept trailer fields in a chunked transfer coding."))
("if-match" ("can be used to make a request method conditional on the current existence or value of an entity-tag for one or more representations of the target resource."))
("if-modified-since" ("can be used with GET or HEAD to make the method conditional by modification date: if the selected representation has not been modified since the time specified in this field, then do not perform the request method; instead, respond as detailed below."))
("if-none-match" ("can be used to make a request method conditional on not matching any of the current entity-tag values for representations of the target resource."))
("if-range" ("Informally, its meaning is: if the representation is unchanged, send me the part(s) that I am requesting in Range; otherwise, send me the entire representation."))
("if-unmodified-since" ("can be used to make a request method conditional by modification date: if the selected representation has been modified since the time specified in this field, then the server MUST NOT perform the requested operation and MUST instead respond with the 412 (Precondition Failed) status code."))
("accept" ("can be used to specify certain media types which are acceptable for the response."))
("accept-charset" ("can be sent by a user agent to indicate what charsets are acceptable in textual response content."))
("accept-encoding" ("can be used by user agents to indicate what response content-codings are acceptable in the response."))
("accept-language" ("can be used by user agents to indicate the set of natural languages that are preferred in the response."))
("authorization" ("allows a user agent to authenticate itself with a server -- usually, but not necessarily, after receiving a 401 (Unauthorized) response."))
("proxy-authorization" ("allows the client to identify itself (or its user) to a proxy that requires authentication."))
("dnt" ("defined as the means for expressing a user's tracking preference via HTTP."))
("from" ("contains an Internet email address for a human user who controls the requesting user agent."))
("referer" ("allows the user agent to specify a URI reference for the resource from which the target URI was obtained (i.e., the referrer, though the field name is misspelled)."))
("user-agent" ("contains information about the user agent originating the request, which is often used by servers to help identify the scope of reported interoperability problems, to work around or tailor responses to avoid particular user agent limitations, and for analytics regarding browser or operating system use."))
("age" ("conveys the sender's estimate of the amount of time since the response was generated or successfully validated at the origin server."))
("cache-control" ("is used to specify directives for caches along the request/response chain."))
("expires" ("gives the date/time after which the response is considered stale."))
("date" ("represents the date and time at which the message was originated"))
("location" ("is used in some responses to refer to a specific resource in relation to the response."))
("retry-after" ("indicates how long the user agent ought to wait before making a follow-up request."))
("tk" ("defined as an OPTIONAL means for indicating the tracking status that applied to the corresponding request and as a REQUIRED means for indicating that a state-changing request has resulted in an interactive change to the tracking status. "))
("vary" ("describes what parts of a request message, aside from the method and request target, might influence the origin server's process for selecting and representing the response."))
("warning" ("is used to carry additional information about the status or transformation of a message that might not be reflected in the message."))
("etag" ("provides the current entity-tag for the selected representation, as determined at the conclusion of handling the request."))
("last-modified" ("provides a timestamp indicating the date and time at which the origin server believes the selected representation was last modified, as determined at the conclusion of handling the request."))
("www-authenticate" ("consists of at least one challenge that indicates the authentication scheme(s) and parameters applicable to the effective request URI."))
("proxy-authenticate" ("consists of at least one challenge that indicates the authentication scheme(s) and parameters applicable to the proxy for this effective request URI."))
("accept-ranges" ("allows a server to indicate that it supports range requests for the target resource."))
("allow" ("lists the set of methods advertised as supported by the target resource."))
("server" ("contains information about the software used by the origin server to handle the request, which is often used by clients to help identify the scope of reported interoperability problems, to work around or tailor requests to avoid particular server limitations, and for analytics regarding server or operating system use."))
("accept-patch" ("used to specify the patch document formats accepted by the server."))
("accept-post" ("indicates server support for specific media types for entity bodies in HTTP POST requests."))
("access-control-allow-credentials" ("indicates whether the response to request can be exposed when the omit credentials flag is unset"))
("access-control-allow-headers" ("indicates, as part of the response to a preflight request, which header field names can be used during the actual request"))
("access-control-allow-methods" ("indicates, as part of the response to a preflight request, which methods can be used during the actual request"))
("access-control-allow-origin" ("indicates whether a resource can be shared"))
("access-control-expose-headers" ("indicates which headers are safe to expose to the API of a CORS API specification"))
("access-control-max-age" ("indicates how long the results of a preflight request can be cached in a preflight result cache"))
("access-control-request-headers" ("indicates which headers will be used in the actual request as part of the preflight request"))
("access-control-request-method" ("indicates which method will be used in the actual request as part of the preflight request"))
("content-disposition" ("standard"))
("content-security-policy" ("is the preferred mechanism for delivering a CSP policy"))
("content-security-policy-report-only" ("lets servers experiment with policies by monitoring (rather than enforcing) a policy"))
("cookie" ("standard"))
("forwarded" ("standard"))
("link" ("provides a means for serialising one or more links in HTTP headers."))
("origin" ("standard"))
("prefer" ("is used to indicate that particular server behaviors are preferred by the client, but not required for successful completion of the request."))
("preference-applied" ("MAY be included within a response message as an indication as to which Prefer tokens were honored by the server and applied to the processing of a request."))
("set-cookie" ("standard"))
("strict-transport-security" ("standard"))
("accept-ch" ("advertise support for Client Hints"))
("accept-features" ("can be used by a user agent to give information about the presence or absence of certain features in the feature set of the current request."))
("alpn" ("indicates the application-layer protocol that a client intends to use within the tunnel, or a set of protocols that might be used within the tunnel."))
("alt-svc" ("is advertising the availability of alternate services to HTTP/1.1 and HTTP/2.0 clients by adding an Alt-Svc header field to responses."))
("alternates" ("is used to convey the list of variants bound to a negotiable resource."))
("ch" ("describes an example list of client preferences that the server can use to adapt and optimize the resource to satisfy a given request."))
("content-base" ("obsoleted"))
("content-dpr" ("is a number that indicates the ratio between physical pixels over CSS px of the selected image response."))
("dasl" ("standard"))
("dav" ("standard"))
("depth" ("standard"))
("destination" ("standard"))
("dpr" ("is a number that, in requests, indicates the clients current Device Pixel Ratio (DPR), which is the ratio of physical pixels over CSS px of the layout viewport on the device."))
("encryption" ("describes the encrypted content encoding(s) that have been applied to a payload body, and therefore how those content encoding(s) can be removed."))
("encryption-key" ("can be used to describe the input keying material used in the Encryption header field."))
("if" ("standard"))
("if-schedule-tag-match" ("standard"))
("key" ("allows an origin server to describe the cache key for a negotiated response: a short algorithm that can be used upon later requests to determine if the same response is reusable."))
("last-event-id" ("The value of the event source's last event ID string, encoded as UTF-8."))
("link-template" ("provides a means for serialising one or more links into HTTP headers."))
("lock-token" ("standard"))
("md" ("is a number that, in requests, indicates the clients maximum downlink speed in megabits per second (Mbps), which is the standardized, or generally accepted, maximum download data rate for the underlying connection technology in use by the client."))
("negotiate" ("can contain directives for any content negotiation process initiated by the request."))
("nice" ("indicates that a request is less important than a request that doesn't bear this header."))
("ordering-type" ("standard"))
("overwrite" ("standard"))
("poe" ("The POE HTTP header is a request-header field whose field-value indicates the version of POE that a client supports."))
("poe-links" ("The POE-Links HTTP header is an entity-header field whose field-value is a comma-separated list of quoted URI-references (without fragment identifiers) that the origin server asserts to be POE resources. The contents of the POE-Links response header SHOULD correspond to links found in the content of the response body."))
("position" ("standard"))
("rw" ("is a number that, in requests, indicates the Resource Width (RW) in CSS px, which is either the display width of the requested resource (e.g. display width of an image), or the layout viewport width if the resource does not have a display width (e.g. a non-image asset)."))
("schedule-reply" ("standard"))
("schedule-tag" ("standard"))
("sec-websocket-accept" ("standard"))
("sec-websocket-extensions" ("standard"))
("sec-websocket-key" ("standard"))
("sec-websocket-protocol" ("standard"))
("sec-websocket-version" ("standard"))
("slug" ("standard"))
("sunset" ("allows a server to communicate the fact that a resource is expected to become unresponsive at a specific point in time."))
("tcn" ("is used by a server to signal that the resource is transparently negotiated."))
("timeout" ("standard"))
("variant-vary" ("can be used in a choice response to record any vary information which applies to the variant data (the entity body combined with some of the entity headers) contained in the response, rather than to the response as a whole."))
("x-frame-options" ("indicates a policy that specifies whether the browser should render the transmitted resource within a &lt;frame&gt; or an &lt;iframe&gt;. Servers can declare this policy in the header of their HTTP responses to prevent clickjacking attacks, which ensures that their content is not embedded into other pages or frames."))))
;;;###autoload
(defun http-header (header)
"Display the meaning of an HTTP header"
(interactive
(list (completing-read "Enter HTTP header: " http-headers)))
(let* ((lowercased-header (downcase header))
(found (assoc lowercased-header http-headers)))
(if found
(let ((description (car (cdr found))))
(message
"%s - HTTP header\n%s"
lowercased-header (car description) ))
(message "%s - HTTP header\nUNKNOWN" lowercased-header))
))
(provide 'http-headers)
;;; http-headers.el ends here

View File

@ -0,0 +1,38 @@
;;; http-methods.el --- Look up the meaning of HTTP methods
;;
;; This file was automatically generated by
;; https://github.com/for-GET/know-your-http-well
;;
;;; Commentary:
;;; Code goes here:
(defconst http-methods
'(("CONNECT" ("requests that the recipient establish a tunnel to the destination origin server identified by the request-target and, if successful, thereafter restrict its behavior to blind forwarding of packets, in both directions, until the connection is closed."))
("DELETE" ("requests that the origin server remove the association between the target resource and its current functionality."))
("GET" ("requests transfer of a current selected representation for the target resource."))
("HEAD" ("is identical to GET except that the server MUST NOT send a message body in the response (i.e., the response terminates at the end of the header block)."))
("OPTIONS" ("requests information about the communication options available on the request/response chain identified by the effective request URI."))
("POST" ("requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics."))
("PUT" ("requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload."))
("TRACE" ("is used to invoke a remote, application-layer loopback of the request message."))
("PATCH" ("requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI."))))
;;;###autoload
(defun http-method (method)
"Display the meaning of an HTTP method"
(interactive
(list (completing-read "Enter HTTP method: " http-methods)))
(let* ((uppercased-method (upcase method))
(found (assoc uppercased-method http-methods)))
(if found
(let ((description (car (cdr found))))
(message
"%s - HTTP method\n%s"
uppercased-method (car description) ))
(message "%s - HTTP method\nUNKNOWN" uppercased-method))
))
(provide 'http-methods)
;;; http-methods.el ends here

View File

@ -0,0 +1,96 @@
;;; http-relations.el --- Look up the meaning of HTTP relations
;;
;; This file was automatically generated by
;; https://github.com/for-GET/know-your-http-well
;;
;;; Commentary:
;;; Code goes here:
(defconst http-relations
'(("about" ("Refers to a resource that is the subject of the link's context."))
("alternate" ("Refers to a substitute for this context"))
("appendix" ("Refers to an appendix."))
("archives" ("Refers to a collection of records, documents, or other materials of historical interest."))
("author" ("Refers to the context's author."))
("bookmark" ("Gives a permanent link to use for bookmarking purposes."))
("canonical" ("Designates the preferred version of a resource (the IRI and its contents)."))
("chapter" ("Refers to a chapter in a collection of resources."))
("collection" ("The target IRI points to a resource which represents the collection resource for the context IRI."))
("contents" ("Refers to a table of contents."))
("copyright" ("Refers to a copyright statement that applies to the link's context."))
("create-form" ("The target IRI points to a resource where a submission form can be obtained."))
("current" ("Refers to a resource containing the most recent item(s) in a collection of resources."))
("describedby" ("Refers to a resource providing information about the link's context."))
("describes" ("The relationship A 'describes' B asserts that resource A provides a description of resource B. There are no constraints on the format or representation of either A or B, neither are there any further constraints on either resource."))
("disclosure" ("Refers to a list of patent disclosures made with respect to material for which `disclosure` relation is specified."))
("duplicate" ("Refers to a resource whose available representations are byte-for-byte identical with the corresponding representations of the context IRI."))
("edit" ("Refers to a resource that can be used to edit the link's context."))
("edit-form" ("The target IRI points to a resource where a submission form for editing associated resource can be obtained."))
("edit-media" ("Refers to a resource that can be used to edit media associated with the link's context."))
("enclosure" ("Identifies a related resource that is potentially large and might require special handling."))
("first" ("An IRI that refers to the furthest preceding resource in a series of resources."))
("glossary" ("Refers to a glossary of terms."))
("help" ("Refers to context-sensitive help."))
("hosts" ("Refers to a resource hosted by the server indicated by the link context."))
("hub" ("Refers to a hub that enables registration for notification of updates to the context."))
("icon" ("Refers to an icon representing the link's context."))
("index" ("Refers to an index."))
("item" ("The target IRI points to a resource that is a member of the collection represented by the context IRI."))
("last" ("An IRI that refers to the furthest following resource in a series of resources."))
("latest-version" ("Points to a resource containing the latest (e.g., current) version of the context."))
("license" ("Refers to a license associated with this context."))
("lrdd" ("Refers to further information about the link's context, expressed as a LRDD (Link-based Resource Descriptor Document) resource. See [RFC6415](https://tools.ietf.org/html/rfc6415) for information about processing this relation type in host-meta documents. When used elsewhere, it refers to additional links and other metadata. Multiple instances indicate additional LRDD resources. LRDD resources MUST have an application/xrd+xml representation, and MAY have others."))
("monitor" ("Refers to a resource that can be used to monitor changes in an HTTP resource."))
("monitor-group" ("Refers to a resource that can be used to monitor changes in a specified group of HTTP resources."))
("next" ("Indicates that the link's context is a part of a series, and that the next in the series is the link target."))
("next-archive" ("Refers to the immediately following archive resource."))
("nofollow" ("Indicates that the contexts original author or publisher does not endorse the link target."))
("noreferrer" ("Indicates that no referrer information is to be leaked when following the link."))
("payment" ("Indicates a resource where payment is accepted."))
("predecessor-version" ("Points to a resource containing the predecessor version in the version history."))
("prefetch" ("Indicates that the link target should be preemptively cached."))
("prev" ("Indicates that the link's context is a part of a series, and that the previous in the series is the link target."))
("preview" ("Refers to a resource that provides a preview of the link's context."))
("previous" ("Refers to the previous resource in an ordered series of resources. Synonym for `prev`."))
("prev-archive" ("Refers to the immediately preceding archive resource."))
("privacy-policy" ("Refers to a privacy policy associated with the link's context."))
("profile" ("Identifying that a resource representation conforms to a certain profile, without affecting the non-profile semantics of the resource representation"))
("related" ("Identifies a related resource."))
("replies" ("Identifies a resource that is a reply to the context of the link."))
("search" ("Refers to a resource that can be used to search through the link's context and related resources."))
("section" ("Refers to a section in a collection of resources."))
("self" ("Conveys an identifier for the link's context."))
("service" ("Indicates a URI that can be used to retrieve a service document."))
("start" ("Refers to the first resource in a collection of resources."))
("stylesheet" ("Refers to a stylesheet."))
("subsection" ("Refers to a resource serving as a subsection in a collection of resources."))
("successor-version" ("Points to a resource containing the successor version in the version history."))
("tag" ("Gives a tag (identified by the given address) that applies to the current document."))
("terms-of-service" ("Refers to the terms of service associated with the link's context."))
("type" ("Refers to a resource identifying the abstract semantic type of which the link's context is considered to be an instance."))
("up" ("Refers to a parent document in a hierarchy of documents."))
("version-history" ("Points to a resource containing the version history for the context."))
("via" ("Identifies a resource that is the source of the information in the link's context."))
("working-copy" ("Points to a working copy for this resource."))
("working-copy-of" ("Points to the versioned resource from which this working copy was obtained."))
("blocked-by" ("Identifies the entity blocking access to a resource folllowing on receipt of a legal demand."))))
;;;###autoload
(defun http-relation (relation)
"Display the meaning of an HTTP relation"
(interactive
(list (completing-read "Enter HTTP relation: " http-relations)))
(let* ((lowercased-relation (downcase relation))
(found (assoc lowercased-relation http-relations)))
(if found
(let ((description (car (cdr found))))
(message
"%s - HTTP relation\n%s"
lowercased-relation (car description) ))
(message "%s - HTTP relation\nUNKNOWN" lowercased-relation))
))
(provide 'http-relations)
;;; http-relation.el ends here

View File

@ -0,0 +1,169 @@
;;; http-status-codes.el --- Look up the meaning of HTTP status codes
;;
;; This file was automatically generated by
;; https://github.com/for-GET/know-your-http-well
;; based on the template of Ruslan Spivak
;;
;; Copyright (C) 2011 Ruslan Spivak
;;
;; Author: Ruslan Spivak <ruslan.spivak@gmail.com>
;; URL: http://github.com/rspivak/httpcode.el
;; Version: 0.1
;;
;; This program 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; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program 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.
;;
;;; Commentary:
;;
;; Explain the meaning of an HTTP status code. Copy http-status-codes.el to your
;; load-path and add to your .emacs:
;;
;; (require 'http-status-codes)
;;
;; Then run it with M-x http-status-code
;;
;;; Code goes here:
(defconst http-status
'(("100" ("Continue" "indicates that the initial part of a request has been received and has not yet been rejected by the server."))
("CONTINUE" ("100" "indicates that the initial part of a request has been received and has not yet been rejected by the server."))
("101" ("Switching Protocols" "indicates that the server understands and is willing to comply with the client's request, via the Upgrade header field, for a change in the application protocol being used on this connection."))
("SWITCHING_PROTOCOLS" ("101" "indicates that the server understands and is willing to comply with the client's request, via the Upgrade header field, for a change in the application protocol being used on this connection."))
("200" ("OK" "indicates that the request has succeeded."))
("OK" ("200" "indicates that the request has succeeded."))
("201" ("Created" "indicates that the request has been fulfilled and has resulted in one or more new resources being created."))
("CREATED" ("201" "indicates that the request has been fulfilled and has resulted in one or more new resources being created."))
("202" ("Accepted" "indicates that the request has been accepted for processing, but the processing has not been completed."))
("ACCEPTED" ("202" "indicates that the request has been accepted for processing, but the processing has not been completed."))
("203" ("Non-Authoritative Information" "indicates that the request was successful but the enclosed payload has been modified from that of the origin server's 200 (OK) response by a transforming proxy."))
("NON_AUTHORITATIVE_INFORMATION" ("203" "indicates that the request was successful but the enclosed payload has been modified from that of the origin server's 200 (OK) response by a transforming proxy."))
("204" ("No Content" "indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body."))
("NO_CONTENT" ("204" "indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body."))
("205" ("Reset Content" "indicates that the server has fulfilled the request and desires that the user agent reset the document view, which caused the request to be sent, to its original state as received from the origin server."))
("RESET_CONTENT" ("205" "indicates that the server has fulfilled the request and desires that the user agent reset the document view, which caused the request to be sent, to its original state as received from the origin server."))
("206" ("Partial Content" "indicates that the server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the requests's Range header field."))
("PARTIAL_CONTENT" ("206" "indicates that the server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the requests's Range header field."))
("300" ("Multiple Choices" "indicates that the target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers."))
("MULTIPLE_CHOICES" ("300" "indicates that the target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers."))
("301" ("Moved Permanently" "indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs."))
("MOVED_PERMANENTLY" ("301" "indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs."))
("302" ("Found" "indicates that the target resource resides temporarily under a different URI."))
("FOUND" ("302" "indicates that the target resource resides temporarily under a different URI."))
("303" ("See Other" "indicates that the server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, that is intended to provide an indirect response to the original request."))
("SEE_OTHER" ("303" "indicates that the server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, that is intended to provide an indirect response to the original request."))
("304" ("Not Modified" "indicates that a conditional GET request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition has evaluated to false."))
("NOT_MODIFIED" ("304" "indicates that a conditional GET request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition has evaluated to false."))
("305" ("Use Proxy" "*deprecated*"))
("USE_PROXY" ("305" "*deprecated*"))
("307" ("Temporary Redirect" "indicates that the target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI."))
("TEMPORARY_REDIRECT" ("307" "indicates that the target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI."))
("400" ("Bad Request" "indicates that the server cannot or will not process the request because the received syntax is invalid, nonsensical, or exceeds some limitation on what the server is willing to process."))
("BAD_REQUEST" ("400" "indicates that the server cannot or will not process the request because the received syntax is invalid, nonsensical, or exceeds some limitation on what the server is willing to process."))
("401" ("Unauthorized" "indicates that the request has not been applied because it lacks valid authentication credentials for the target resource."))
("UNAUTHORIZED" ("401" "indicates that the request has not been applied because it lacks valid authentication credentials for the target resource."))
("402" ("Payment Required" "*reserved*"))
("PAYMENT_REQUIRED" ("402" "*reserved*"))
("403" ("Forbidden" "indicates that the server understood the request but refuses to authorize it."))
("FORBIDDEN" ("403" "indicates that the server understood the request but refuses to authorize it."))
("404" ("Not Found" "indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists."))
("NOT_FOUND" ("404" "indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists."))
("405" ("Method Not Allowed" "indicates that the method specified in the request-line is known by the origin server but not supported by the target resource."))
("METHOD_NOT_ALLOWED" ("405" "indicates that the method specified in the request-line is known by the origin server but not supported by the target resource."))
("406" ("Not Acceptable" "indicates that the target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation."))
("NOT_ACCEPTABLE" ("406" "indicates that the target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation."))
("407" ("Proxy Authentication Required" "is similar to 401 (Unauthorized), but indicates that the client needs to authenticate itself in order to use a proxy."))
("PROXY_AUTHENTICATION_REQUIRED" ("407" "is similar to 401 (Unauthorized), but indicates that the client needs to authenticate itself in order to use a proxy."))
("408" ("Request Timeout" "indicates that the server did not receive a complete request message within the time that it was prepared to wait."))
("REQUEST_TIMEOUT" ("408" "indicates that the server did not receive a complete request message within the time that it was prepared to wait."))
("409" ("Conflict" "indicates that the request could not be completed due to a conflict with the current state of the resource."))
("CONFLICT" ("409" "indicates that the request could not be completed due to a conflict with the current state of the resource."))
("410" ("Gone" "indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent."))
("GONE" ("410" "indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent."))
("411" ("Length Required" "indicates that the server refuses to accept the request without a defined Content-Length."))
("LENGTH_REQUIRED" ("411" "indicates that the server refuses to accept the request without a defined Content-Length."))
("412" ("Precondition Failed" "indicates that one or more preconditions given in the request header fields evaluated to false when tested on the server."))
("PRECONDITION_FAILED" ("412" "indicates that one or more preconditions given in the request header fields evaluated to false when tested on the server."))
("413" ("Payload Too Large" "indicates that the server is refusing to process a request because the request payload is larger than the server is willing or able to process."))
("PAYLOAD_TOO_LARGE" ("413" "indicates that the server is refusing to process a request because the request payload is larger than the server is willing or able to process."))
("414" ("URI Too Long" "indicates that the server is refusing to service the request because the request-target is longer than the server is willing to interpret."))
("URI_TOO_LONG" ("414" "indicates that the server is refusing to service the request because the request-target is longer than the server is willing to interpret."))
("415" ("Unsupported Media Type" "indicates that the origin server is refusing to service the request because the payload is in a format not supported by the target resource for this method."))
("UNSUPPORTED_MEDIA_TYPE" ("415" "indicates that the origin server is refusing to service the request because the payload is in a format not supported by the target resource for this method."))
("416" ("Range Not Satisfiable" "indicates that none of the ranges in the request's Range header field overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges."))
("RANGE_NOT_SATISFIABLE" ("416" "indicates that none of the ranges in the request's Range header field overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges."))
("417" ("Expectation Failed" "indicates that the expectation given in the request's Expect header field could not be met by at least one of the inbound servers."))
("EXPECTATION_FAILED" ("417" "indicates that the expectation given in the request's Expect header field could not be met by at least one of the inbound servers."))
("418" ("I'm a teapot" "Any attempt to brew coffee with a teapot should result in the error code 418 I'm a teapot."))
("I_M_A_TEAPOT" ("418" "Any attempt to brew coffee with a teapot should result in the error code 418 I'm a teapot."))
("426" ("Upgrade Required" "indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol."))
("UPGRADE_REQUIRED" ("426" "indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol."))
("500" ("Internal Server Error" "indicates that the server encountered an unexpected condition that prevented it from fulfilling the request."))
("INTERNAL_SERVER_ERROR" ("500" "indicates that the server encountered an unexpected condition that prevented it from fulfilling the request."))
("501" ("Not Implemented" "indicates that the server does not support the functionality required to fulfill the request."))
("NOT_IMPLEMENTED" ("501" "indicates that the server does not support the functionality required to fulfill the request."))
("502" ("Bad Gateway" "indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request."))
("BAD_GATEWAY" ("502" "indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request."))
("503" ("Service Unavailable" "indicates that the server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay."))
("SERVICE_UNAVAILABLE" ("503" "indicates that the server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay."))
("504" ("Gateway Time-out" "indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request."))
("GATEWAY_TIME_OUT" ("504" "indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request."))
("505" ("HTTP Version Not Supported" "indicates that the server does not support, or refuses to support, the protocol version that was used in the request message."))
("HTTP_VERSION_NOT_SUPPORTED" ("505" "indicates that the server does not support, or refuses to support, the protocol version that was used in the request message."))
("102" ("Processing" "is an interim response used to inform the client that the server has accepted the complete request, but has not yet completed it."))
("PROCESSING" ("102" "is an interim response used to inform the client that the server has accepted the complete request, but has not yet completed it."))
("207" ("Multi-Status" "provides status for multiple independent operations."))
("MULTI_STATUS" ("207" "provides status for multiple independent operations."))
("226" ("IM Used" "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."))
("IM_USED" ("226" "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."))
("308" ("Permanent Redirect" "The target resource has been assigned a new permanent URI and any future references to this resource outght to use one of the enclosed URIs. [...] This status code is similar to 301 Moved Permanently (Section 7.3.2 of rfc7231), except that it does not allow rewriting the request method from POST to GET."))
("PERMANENT_REDIRECT" ("308" "The target resource has been assigned a new permanent URI and any future references to this resource outght to use one of the enclosed URIs. [...] This status code is similar to 301 Moved Permanently (Section 7.3.2 of rfc7231), except that it does not allow rewriting the request method from POST to GET."))
("422" ("Unprocessable Entity" "means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions."))
("UNPROCESSABLE_ENTITY" ("422" "means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions."))
("423" ("Locked" "means the source or destination resource of a method is locked."))
("LOCKED" ("423" "means the source or destination resource of a method is locked."))
("424" ("Failed Dependency" "means that the method could not be performed on the resource because the requested action depended on another action and that action failed."))
("FAILED_DEPENDENCY" ("424" "means that the method could not be performed on the resource because the requested action depended on another action and that action failed."))
("428" ("Precondition Required" "indicates that the origin server requires the request to be conditional."))
("PRECONDITION_REQUIRED" ("428" "indicates that the origin server requires the request to be conditional."))
("429" ("Too Many Requests" "indicates that the user has sent too many requests in a given amount of time (rate limiting)."))
("TOO_MANY_REQUESTS" ("429" "indicates that the user has sent too many requests in a given amount of time (rate limiting)."))
("431" ("Request Header Fields Too Large" "indicates that the server is unwilling to process the request because its header fields are too large."))
("REQUEST_HEADER_FIELDS_TOO_LARGE" ("431" "indicates that the server is unwilling to process the request because its header fields are too large."))
("451" ("Unavailable For Legal Reasons" "This status code indicates that the server is denying access to the resource in response to a legal demand."))
("UNAVAILABLE_FOR_LEGAL_REASONS" ("451" "This status code indicates that the server is denying access to the resource in response to a legal demand."))
("506" ("Variant Also Negotiates" "indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process."))
("VARIANT_ALSO_NEGOTIATES" ("506" "indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process."))
("507" ("Insufficient Storage" "means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request."))
("INSUFFICIENT_STORAGE" ("507" "means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request."))
("511" ("Network Authentication Required" "indicates that the client needs to authenticate to gain network access."))
("NETWORK_AUTHENTICATION_REQUIRED" ("511" "indicates that the client needs to authenticate to gain network access."))))
;;;###autoload
(defun http-status-code (status)
"Display the meaning of an HTTP status code or phrase"
(interactive
(list (completing-read "Enter HTTP status code or phrase: " http-status)))
(let* ((uppercased-status (upcase status))
(found (assoc uppercased-status http-status)))
(if found
(let* ((status-code (car found))
(status-code-attrib (cdr found))
(phrase (car (car status-code-attrib)))
(description (car (cdr (car status-code-attrib)))))
(message
"%s - HTTP status\n%s\n%s"
status-code phrase description))
(message "%s - HTTP status\nUNKNOWN" uppercased-status))
))
(provide 'http-status-codes)
;;; http-status-codes.el ends here

View File

@ -0,0 +1,71 @@
;;; know-your-http-well-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "http-headers" "http-headers.el" (22538 5602
;;;;;; 494844 678000))
;;; Generated autoloads from http-headers.el
(autoload 'http-header "http-headers" "\
Display the meaning of an HTTP header
\(fn HEADER)" t nil)
;;;***
;;;### (autoloads nil "http-methods" "http-methods.el" (22538 5602
;;;;;; 510844 646000))
;;; Generated autoloads from http-methods.el
(autoload 'http-method "http-methods" "\
Display the meaning of an HTTP method
\(fn METHOD)" t nil)
;;;***
;;;### (autoloads nil "http-relations" "http-relations.el" (22538
;;;;;; 5602 502844 661000))
;;; Generated autoloads from http-relations.el
(autoload 'http-relation "http-relations" "\
Display the meaning of an HTTP relation
\(fn RELATION)" t nil)
;;;***
;;;### (autoloads nil "http-status-codes" "http-status-codes.el"
;;;;;; (22538 5602 510844 646000))
;;; Generated autoloads from http-status-codes.el
(autoload 'http-status-code "http-status-codes" "\
Display the meaning of an HTTP status code or phrase
\(fn STATUS)" t nil)
;;;***
;;;### (autoloads nil "media-types" "media-types.el" (22538 5602
;;;;;; 514844 638000))
;;; Generated autoloads from media-types.el
(autoload 'media-type "media-types" "\
Display the template of a media-type
\(fn MEDIA-TYPE)" t nil)
;;;***
;;;### (autoloads nil nil ("know-your-http-well-pkg.el" "know-your-http-well.el")
;;;;;; (22538 5602 526844 613000))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; know-your-http-well-autoloads.el ends here

View File

@ -0,0 +1,4 @@
(define-package "know-your-http-well" "20160208.1504" "Look up the meaning of HTTP headers, methods, relations, status codes" 'nil)
;; Local Variables:
;; no-byte-compile: t
;; End:

View File

@ -0,0 +1,11 @@
;;; know-your-http-well.el --- Look up the meaning of HTTP headers, methods, relations, status codes
;;; Commentary:
;;; Code:
(require 'http-headers)
(require 'http-methods)
(require 'http-relations)
(require 'http-status-codes)
(provide 'know-your-http-well)
;;; know-your-http-well.el ends here

View File

@ -0,0 +1,417 @@
;;; media-types.el --- Look up the template of a media-type
;;
;; This file was automatically generated by
;; https://github.com/for-GET/know-your-http-well
;;
;;; Commentary:
;;; Code goes here:
(defconst media-types
'(("application/1d-interleaved-parityfec" ("https://www.iana.org/assignments/media-types/application/1d-interleaved-parityfec"))
("application/a2l" ("https://www.iana.org/assignments/media-types/application/A2L"))
("application/activemessage" ("https://www.iana.org/assignments/media-types/application/activemessage"))
("application/activemessage" ("https://www.iana.org/assignments/media-types/application/activemessage"))
("application/aml" ("https://www.iana.org/assignments/media-types/application/AML"))
("application/andrew-inset" ("https://www.iana.org/assignments/media-types/application/andrew-inset"))
("application/applefile" ("https://www.iana.org/assignments/media-types/application/applefile"))
("application/atf" ("https://www.iana.org/assignments/media-types/application/ATF"))
("application/atfx" ("https://www.iana.org/assignments/media-types/application/ATFX"))
("application/atomicmail" ("https://www.iana.org/assignments/media-types/application/atomicmail"))
("application/atxml" ("https://www.iana.org/assignments/media-types/application/ATXML"))
("application/batch-smtp" ("https://www.iana.org/assignments/media-types/application/batch-SMTP"))
("application/call-completion" ("https://www.iana.org/assignments/media-types/application/call-completion"))
("application/cals-1840" ("https://www.iana.org/assignments/media-types/application/CALS-1840"))
("application/cbor" ("https://www.iana.org/assignments/media-types/application/cbor"))
("application/cdmi-capability" ("https://www.iana.org/assignments/media-types/application/cdmi-capability"))
("application/cdmi-container" ("https://www.iana.org/assignments/media-types/application/cdmi-container"))
("application/cdmi-domain" ("https://www.iana.org/assignments/media-types/application/cdmi-domain"))
("application/cdmi-object" ("https://www.iana.org/assignments/media-types/application/cdmi-object"))
("application/cdmi-queue" ("https://www.iana.org/assignments/media-types/application/cdmi-queue"))
("application/cdni" ("https://www.iana.org/assignments/media-types/application/cdni"))
("application/cea" ("https://www.iana.org/assignments/media-types/application/CEA"))
("application/cfw" ("https://www.iana.org/assignments/media-types/application/cfw"))
("application/cms" ("https://www.iana.org/assignments/media-types/application/cms"))
("application/commonground" ("https://www.iana.org/assignments/media-types/application/commonground"))
("application/csrattrs" ("https://www.iana.org/assignments/media-types/application/csrattrs"))
("application/cybercash" ("https://www.iana.org/assignments/media-types/application/cybercash"))
("application/dashdelta" ("https://www.iana.org/assignments/media-types/application/dashdelta"))
("application/dca-rft" ("https://www.iana.org/assignments/media-types/application/dca-rft"))
("application/dcd" ("https://www.iana.org/assignments/media-types/application/DCD"))
("application/dec-dx" ("https://www.iana.org/assignments/media-types/application/dec-dx"))
("application/dicom" ("https://www.iana.org/assignments/media-types/application/dicom"))
("application/dii" ("https://www.iana.org/assignments/media-types/application/DII"))
("application/dit" ("https://www.iana.org/assignments/media-types/application/DIT"))
("application/dns" ("https://www.iana.org/assignments/media-types/application/dns"))
("application/dvcs" ("https://www.iana.org/assignments/media-types/application/dvcs"))
("application/ecmascript" ("https://www.iana.org/assignments/media-types/application/ecmascript"))
("application/edi-consent" ("https://www.iana.org/assignments/media-types/application/EDI-consent"))
("application/edifact" ("https://www.iana.org/assignments/media-types/application/EDIFACT"))
("application/edi-x12" ("https://www.iana.org/assignments/media-types/application/EDI-X12"))
("application/encaprtp" ("https://www.iana.org/assignments/media-types/application/encaprtp"))
("application/eshop" ("https://www.iana.org/assignments/media-types/application/eshop"))
("application/example" ("https://www.iana.org/assignments/media-types/application/example"))
("application/fastinfoset" ("https://www.iana.org/assignments/media-types/application/fastinfoset"))
("application/fastsoap" ("https://www.iana.org/assignments/media-types/application/fastsoap"))
("application/fits" ("https://www.iana.org/assignments/media-types/application/fits"))
("application/font-sfnt" ("https://www.iana.org/assignments/media-types/application/font-sfnt"))
("application/font-tdpfr" ("https://www.iana.org/assignments/media-types/application/font-tdpfr"))
("application/font-woff" ("https://www.iana.org/assignments/media-types/application/font-woff"))
("application/gzip" ("https://www.iana.org/assignments/media-types/application/gzip"))
("application/h224" ("https://www.iana.org/assignments/media-types/application/H224"))
("application/http" ("https://www.iana.org/assignments/media-types/application/http"))
("application/hyperstudio" ("https://www.iana.org/assignments/media-types/application/hyperstudio"))
("application/ibe-pp-data" ("https://www.iana.org/assignments/media-types/application/ibe-pp-data"))
("application/iges" ("https://www.iana.org/assignments/media-types/application/iges"))
("application/index" ("https://www.iana.org/assignments/media-types/application/index"))
("application/iotp" ("https://www.iana.org/assignments/media-types/application/IOTP"))
("application/ipfix" ("https://www.iana.org/assignments/media-types/application/ipfix"))
("application/ipp" ("https://www.iana.org/assignments/media-types/application/ipp"))
("application/isup" ("https://www.iana.org/assignments/media-types/application/ISUP"))
("application/javascript" ("https://www.iana.org/assignments/media-types/application/javascript"))
("application/jose" ("https://www.iana.org/assignments/media-types/application/jose"))
("application/json" ("https://www.iana.org/assignments/media-types/application/json"))
("application/json-seq" ("https://www.iana.org/assignments/media-types/application/json-seq"))
("application/jwt" ("https://www.iana.org/assignments/media-types/application/jwt"))
("application/link-format" ("https://www.iana.org/assignments/media-types/application/link-format"))
("application/lxf" ("https://www.iana.org/assignments/media-types/application/LXF"))
("application/mac-binhex40" ("https://www.iana.org/assignments/media-types/application/mac-binhex40"))
("application/macwriteii" ("https://www.iana.org/assignments/media-types/application/macwriteii"))
("application/marc" ("https://www.iana.org/assignments/media-types/application/marc"))
("application/mathematica" ("https://www.iana.org/assignments/media-types/application/mathematica"))
("application/mbox" ("https://www.iana.org/assignments/media-types/application/mbox"))
("application/mf4" ("https://www.iana.org/assignments/media-types/application/MF4"))
("application/mikey" ("https://www.iana.org/assignments/media-types/application/mikey"))
("application/moss-keys" ("https://www.iana.org/assignments/media-types/application/moss-keys"))
("application/moss-signature" ("https://www.iana.org/assignments/media-types/application/moss-signature"))
("application/mosskey-data" ("https://www.iana.org/assignments/media-types/application/mosskey-data"))
("application/mosskey-request" ("https://www.iana.org/assignments/media-types/application/mosskey-request"))
("application/mp21" ("https://www.iana.org/assignments/media-types/application/mp21"))
("application/mp4" ("https://www.iana.org/assignments/media-types/application/mp4"))
("application/mpeg4-generic" ("https://www.iana.org/assignments/media-types/application/mpeg4-generic"))
("application/mpeg4-iod" ("https://www.iana.org/assignments/media-types/application/mpeg4-iod"))
("application/mpeg4-iod-xmt" ("https://www.iana.org/assignments/media-types/application/mpeg4-iod-xmt"))
("application/msword" ("https://www.iana.org/assignments/media-types/application/msword"))
("application/mxf" ("https://www.iana.org/assignments/media-types/application/mxf"))
("application/nasdata" ("https://www.iana.org/assignments/media-types/application/nasdata"))
("application/news-checkgroups" ("https://www.iana.org/assignments/media-types/application/news-checkgroups"))
("application/news-groupinfo" ("https://www.iana.org/assignments/media-types/application/news-groupinfo"))
("application/news-transmission" ("https://www.iana.org/assignments/media-types/application/news-transmission"))
("application/nss" ("https://www.iana.org/assignments/media-types/application/nss"))
("application/ocsp-request" ("https://www.iana.org/assignments/media-types/application/ocsp-request"))
("application/ocsp-response" ("https://www.iana.org/assignments/media-types/application/ocsp-response"))
("application/octet-stream" ("https://www.iana.org/assignments/media-types/application/octet-stream"))
("application/oda" ("https://www.iana.org/assignments/media-types/application/ODA"))
("application/odx" ("https://www.iana.org/assignments/media-types/application/ODX"))
("application/ogg" ("https://www.iana.org/assignments/media-types/application/ogg"))
("application/oxps" ("https://www.iana.org/assignments/media-types/application/oxps"))
("application/pdf" ("https://www.iana.org/assignments/media-types/application/pdf"))
("application/pdx" ("https://www.iana.org/assignments/media-types/application/PDX"))
("application/pgp-encrypted" ("https://www.iana.org/assignments/media-types/application/pgp-encrypted"))
("application/pgp-signature" ("https://www.iana.org/assignments/media-types/application/pgp-signature"))
("application/pkcs10" ("https://www.iana.org/assignments/media-types/application/pkcs10"))
("application/pkcs7-mime" ("https://www.iana.org/assignments/media-types/application/pkcs7-mime"))
("application/pkcs7-signature" ("https://www.iana.org/assignments/media-types/application/pkcs7-signature"))
("application/pkcs8" ("https://www.iana.org/assignments/media-types/application/pkcs8"))
("application/pkcs12" ("https://www.iana.org/assignments/media-types/application/pkcs12"))
("application/pkix-attr-cert" ("https://www.iana.org/assignments/media-types/application/pkix-attr-cert"))
("application/pkix-cert" ("https://www.iana.org/assignments/media-types/application/pkix-cert"))
("application/pkix-crl" ("https://www.iana.org/assignments/media-types/application/pkix-crl"))
("application/pkix-pkipath" ("https://www.iana.org/assignments/media-types/application/pkix-pkipath"))
("application/pkixcmp" ("https://www.iana.org/assignments/media-types/application/pkixcmp"))
("application/postscript" ("https://www.iana.org/assignments/media-types/application/postscript"))
("application/qsig" ("https://www.iana.org/assignments/media-types/application/QSIG"))
("application/raptorfec" ("https://www.iana.org/assignments/media-types/application/raptorfec"))
("application/relax-ng-compact-syntax" ("https://www.iana.org/assignments/media-types/application/relax-ng-compact-syntax"))
("application/remote-printing" ("https://www.iana.org/assignments/media-types/application/remote-printing"))
("application/riscos" ("https://www.iana.org/assignments/media-types/application/riscos"))
("application/rpki-ghostbusters" ("https://www.iana.org/assignments/media-types/application/rpki-ghostbusters"))
("application/rpki-manifest" ("https://www.iana.org/assignments/media-types/application/rpki-manifest"))
("application/rpki-roa" ("https://www.iana.org/assignments/media-types/application/rpki-roa"))
("application/rpki-updown" ("https://www.iana.org/assignments/media-types/application/rpki-updown"))
("application/rtf" ("https://www.iana.org/assignments/media-types/application/rtf"))
("application/rtploopback" ("https://www.iana.org/assignments/media-types/application/rtploopback"))
("application/rtx" ("https://www.iana.org/assignments/media-types/application/rtx"))
("application/scvp-cv-request" ("https://www.iana.org/assignments/media-types/application/scvp-cv-request"))
("application/scvp-cv-response" ("https://www.iana.org/assignments/media-types/application/scvp-cv-response"))
("application/scvp-vp-request" ("https://www.iana.org/assignments/media-types/application/scvp-vp-request"))
("application/scvp-vp-response" ("https://www.iana.org/assignments/media-types/application/scvp-vp-response"))
("application/sdp" ("https://www.iana.org/assignments/media-types/application/sdp"))
("application/sep-exi" ("https://www.iana.org/assignments/media-types/application/sep-exi"))
("application/session-info" ("https://www.iana.org/assignments/media-types/application/session-info"))
("application/set-payment" ("https://www.iana.org/assignments/media-types/application/set-payment"))
("application/set-payment-initiation" ("https://www.iana.org/assignments/media-types/application/set-payment-initiation"))
("application/set-registration" ("https://www.iana.org/assignments/media-types/application/set-registration"))
("application/set-registration-initiation" ("https://www.iana.org/assignments/media-types/application/set-registration-initiation"))
("application/sgml" ("https://www.iana.org/assignments/media-types/application/SGML"))
("application/sgml-open-catalog" ("https://www.iana.org/assignments/media-types/application/sgml-open-catalog"))
("application/sieve" ("https://www.iana.org/assignments/media-types/application/sieve"))
("application/simple-message-summary" ("https://www.iana.org/assignments/media-types/application/simple-message-summary"))
("application/simplesymbolcontainer" ("https://www.iana.org/assignments/media-types/application/simpleSymbolContainer"))
("application/slate" ("https://www.iana.org/assignments/media-types/application/slate"))
("application/smpte336m" ("https://www.iana.org/assignments/media-types/application/smpte336m"))
("application/sql" ("https://www.iana.org/assignments/media-types/application/sql"))
("application/srgs" ("https://www.iana.org/assignments/media-types/application/srgs"))
("application/tamp-apex-update" ("https://www.iana.org/assignments/media-types/application/tamp-apex-update"))
("application/tamp-apex-update-confirm" ("https://www.iana.org/assignments/media-types/application/tamp-apex-update-confirm"))
("application/tamp-community-update" ("https://www.iana.org/assignments/media-types/application/tamp-community-update"))
("application/tamp-community-update-confirm" ("https://www.iana.org/assignments/media-types/application/tamp-community-update-confirm"))
("application/tamp-error" ("https://www.iana.org/assignments/media-types/application/tamp-error"))
("application/tamp-sequence-adjust" ("https://www.iana.org/assignments/media-types/application/tamp-sequence-adjust"))
("application/tamp-sequence-adjust-confirm" ("https://www.iana.org/assignments/media-types/application/tamp-sequence-adjust-confirm"))
("application/tamp-status-query" ("https://www.iana.org/assignments/media-types/application/tamp-status-query"))
("application/tamp-status-response" ("https://www.iana.org/assignments/media-types/application/tamp-status-response"))
("application/tamp-update" ("https://www.iana.org/assignments/media-types/application/tamp-update"))
("application/tamp-update-confirm" ("https://www.iana.org/assignments/media-types/application/tamp-update-confirm"))
("application/timestamp-query" ("https://www.iana.org/assignments/media-types/application/timestamp-query"))
("application/timestamp-reply" ("https://www.iana.org/assignments/media-types/application/timestamp-reply"))
("application/timestamped-data" ("https://www.iana.org/assignments/media-types/application/timestamped-data"))
("application/tve-trigger" ("https://www.iana.org/assignments/media-types/application/tve-trigger"))
("application/ulpfec" ("https://www.iana.org/assignments/media-types/application/ulpfec"))
("application/vemmi" ("https://www.iana.org/assignments/media-types/application/vemmi"))
("application/vq-rtcpxr" ("https://www.iana.org/assignments/media-types/application/vq-rtcpxr"))
("application/whoispp-query" ("https://www.iana.org/assignments/media-types/application/whoispp-query"))
("application/whoispp-response" ("https://www.iana.org/assignments/media-types/application/whoispp-response"))
("application/wita" ("https://www.iana.org/assignments/media-types/application/wita"))
("application/x-www-form-urlencoded" ("https://www.iana.org/assignments/media-types/application/x-www-form-urlencoded"))
("application/x400-bp" ("https://www.iana.org/assignments/media-types/application/x400-bp"))
("application/xml" ("https://www.iana.org/assignments/media-types/application/xml"))
("application/xml-dtd" ("https://www.iana.org/assignments/media-types/application/xml-dtd"))
("application/xml-external-parsed-entity" ("https://www.iana.org/assignments/media-types/application/xml-external-parsed-entity"))
("application/yang" ("https://www.iana.org/assignments/media-types/application/yang"))
("application/zip" ("https://www.iana.org/assignments/media-types/application/zip"))
("application/zlib" ("https://www.iana.org/assignments/media-types/application/zlib"))
("audio/1d-interleaved-parityfec" ("https://www.iana.org/assignments/media-types/audio/1d-interleaved-parityfec"))
("audio/32kadpcm" ("https://www.iana.org/assignments/media-types/audio/32kadpcm"))
("audio/3gpp" ("https://www.iana.org/assignments/media-types/audio/3gpp"))
("audio/3gpp2" ("https://www.iana.org/assignments/media-types/audio/3gpp2"))
("audio/ac3" ("https://www.iana.org/assignments/media-types/audio/ac3"))
("audio/amr" ("https://www.iana.org/assignments/media-types/audio/AMR"))
("audio/amr-wb" ("https://www.iana.org/assignments/media-types/audio/AMR-WB"))
("audio/aptx" ("https://www.iana.org/assignments/media-types/audio/aptx"))
("audio/asc" ("https://www.iana.org/assignments/media-types/audio/asc"))
("audio/atrac-advanced-lossless" ("https://www.iana.org/assignments/media-types/audio/ATRAC-ADVANCED-LOSSLESS"))
("audio/atrac-x" ("https://www.iana.org/assignments/media-types/audio/ATRAC-X"))
("audio/atrac3" ("https://www.iana.org/assignments/media-types/audio/ATRAC3"))
("audio/basic" ("https://www.iana.org/assignments/media-types/audio/basic"))
("audio/bv16" ("https://www.iana.org/assignments/media-types/audio/BV16"))
("audio/bv32" ("https://www.iana.org/assignments/media-types/audio/BV32"))
("audio/clearmode" ("https://www.iana.org/assignments/media-types/audio/clearmode"))
("audio/cn" ("https://www.iana.org/assignments/media-types/audio/CN"))
("audio/dat12" ("https://www.iana.org/assignments/media-types/audio/DAT12"))
("audio/dls" ("https://www.iana.org/assignments/media-types/audio/dls"))
("audio/dsr-es201108" ("https://www.iana.org/assignments/media-types/audio/dsr-es201108"))
("audio/dsr-es202050" ("https://www.iana.org/assignments/media-types/audio/dsr-es202050"))
("audio/dsr-es202211" ("https://www.iana.org/assignments/media-types/audio/dsr-es202211"))
("audio/dsr-es202212" ("https://www.iana.org/assignments/media-types/audio/dsr-es202212"))
("audio/dv" ("https://www.iana.org/assignments/media-types/audio/DV"))
("audio/dvi4" ("https://www.iana.org/assignments/media-types/audio/DVI4"))
("audio/eac3" ("https://www.iana.org/assignments/media-types/audio/eac3"))
("audio/encaprtp" ("https://www.iana.org/assignments/media-types/audio/encaprtp"))
("audio/evrc" ("https://www.iana.org/assignments/media-types/audio/EVRC"))
("audio/evrc-qcp" ("https://www.iana.org/assignments/media-types/audio/EVRC-QCP"))
("audio/evrc0" ("https://www.iana.org/assignments/media-types/audio/EVRC0"))
("audio/evrc1" ("https://www.iana.org/assignments/media-types/audio/EVRC1"))
("audio/evrcb" ("https://www.iana.org/assignments/media-types/audio/EVRCB"))
("audio/evrcb0" ("https://www.iana.org/assignments/media-types/audio/EVRCB0"))
("audio/evrcb1" ("https://www.iana.org/assignments/media-types/audio/EVRCB1"))
("audio/evrcnw" ("https://www.iana.org/assignments/media-types/audio/EVRCNW"))
("audio/evrcnw0" ("https://www.iana.org/assignments/media-types/audio/EVRCNW0"))
("audio/evrcnw1" ("https://www.iana.org/assignments/media-types/audio/EVRCNW1"))
("audio/evrcwb" ("https://www.iana.org/assignments/media-types/audio/EVRCWB"))
("audio/evrcwb0" ("https://www.iana.org/assignments/media-types/audio/EVRCWB0"))
("audio/evrcwb1" ("https://www.iana.org/assignments/media-types/audio/EVRCWB1"))
("audio/evs" ("https://www.iana.org/assignments/media-types/audio/EVS"))
("audio/example" ("https://www.iana.org/assignments/media-types/audio/example"))
("audio/fwdred" ("https://www.iana.org/assignments/media-types/audio/fwdred"))
("audio/g711-0" ("https://www.iana.org/assignments/media-types/audio/G711-0"))
("audio/g719" ("https://www.iana.org/assignments/media-types/audio/G719"))
("audio/g7221" ("https://www.iana.org/assignments/media-types/audio/G7221"))
("audio/g722" ("https://www.iana.org/assignments/media-types/audio/G722"))
("audio/g723" ("https://www.iana.org/assignments/media-types/audio/G723"))
("audio/g726-16" ("https://www.iana.org/assignments/media-types/audio/G726-16"))
("audio/g726-24" ("https://www.iana.org/assignments/media-types/audio/G726-24"))
("audio/g726-32" ("https://www.iana.org/assignments/media-types/audio/G726-32"))
("audio/g726-40" ("https://www.iana.org/assignments/media-types/audio/G726-40"))
("audio/g728" ("https://www.iana.org/assignments/media-types/audio/G728"))
("audio/g729" ("https://www.iana.org/assignments/media-types/audio/G729"))
("audio/g729d" ("https://www.iana.org/assignments/media-types/audio/G729D"))
("audio/g729e" ("https://www.iana.org/assignments/media-types/audio/G729E"))
("audio/gsm" ("https://www.iana.org/assignments/media-types/audio/GSM"))
("audio/gsm-efr" ("https://www.iana.org/assignments/media-types/audio/GSM-EFR"))
("audio/gsm-hr-08" ("https://www.iana.org/assignments/media-types/audio/GSM-HR-08"))
("audio/ilbc" ("https://www.iana.org/assignments/media-types/audio/iLBC"))
("audio/l8" ("https://www.iana.org/assignments/media-types/audio/L8"))
("audio/l16" ("https://www.iana.org/assignments/media-types/audio/L16"))
("audio/l20" ("https://www.iana.org/assignments/media-types/audio/L20"))
("audio/l24" ("https://www.iana.org/assignments/media-types/audio/L24"))
("audio/lpc" ("https://www.iana.org/assignments/media-types/audio/LPC"))
("audio/mobile-xmf" ("https://www.iana.org/assignments/media-types/audio/mobile-xmf"))
("audio/mpa" ("https://www.iana.org/assignments/media-types/audio/MPA"))
("audio/mp4" ("https://www.iana.org/assignments/media-types/audio/mp4"))
("audio/mp4a-latm" ("https://www.iana.org/assignments/media-types/audio/MP4A-LATM"))
("audio/mpa-robust" ("https://www.iana.org/assignments/media-types/audio/mpa-robust"))
("audio/mpeg" ("https://www.iana.org/assignments/media-types/audio/mpeg"))
("audio/mpeg4-generic" ("https://www.iana.org/assignments/media-types/audio/mpeg4-generic"))
("audio/ogg" ("https://www.iana.org/assignments/media-types/audio/ogg"))
("audio/opus" ("https://www.iana.org/assignments/media-types/audio/opus"))
("audio/pcma" ("https://www.iana.org/assignments/media-types/audio/PCMA"))
("audio/pcma-wb" ("https://www.iana.org/assignments/media-types/audio/PCMA-WB"))
("audio/pcmu" ("https://www.iana.org/assignments/media-types/audio/PCMU"))
("audio/pcmu-wb" ("https://www.iana.org/assignments/media-types/audio/PCMU-WB"))
("audio/raptorfec" ("https://www.iana.org/assignments/media-types/audio/raptorfec"))
("audio/red" ("https://www.iana.org/assignments/media-types/audio/RED"))
("audio/rtp-enc-aescm128" ("https://www.iana.org/assignments/media-types/audio/rtp-enc-aescm128"))
("audio/rtploopback" ("https://www.iana.org/assignments/media-types/audio/rtploopback"))
("audio/rtp-midi" ("https://www.iana.org/assignments/media-types/audio/rtp-midi"))
("audio/rtx" ("https://www.iana.org/assignments/media-types/audio/rtx"))
("audio/smv" ("https://www.iana.org/assignments/media-types/audio/SMV"))
("audio/smv0" ("https://www.iana.org/assignments/media-types/audio/SMV0"))
("audio/smv-qcp" ("https://www.iana.org/assignments/media-types/audio/SMV-QCP"))
("audio/sp-midi" ("https://www.iana.org/assignments/media-types/audio/sp-midi"))
("audio/speex" ("https://www.iana.org/assignments/media-types/audio/speex"))
("audio/t140c" ("https://www.iana.org/assignments/media-types/audio/t140c"))
("audio/t38" ("https://www.iana.org/assignments/media-types/audio/t38"))
("audio/telephone-event" ("https://www.iana.org/assignments/media-types/audio/telephone-event"))
("audio/tone" ("https://www.iana.org/assignments/media-types/audio/tone"))
("audio/uemclip" ("https://www.iana.org/assignments/media-types/audio/UEMCLIP"))
("audio/ulpfec" ("https://www.iana.org/assignments/media-types/audio/ulpfec"))
("audio/vdvi" ("https://www.iana.org/assignments/media-types/audio/VDVI"))
("audio/vmr-wb" ("https://www.iana.org/assignments/media-types/audio/VMR-WB"))
("audio/vorbis" ("https://www.iana.org/assignments/media-types/audio/vorbis"))
("audio/vorbis-config" ("https://www.iana.org/assignments/media-types/audio/vorbis-config"))
("image/cgm" ("https://www.iana.org/assignments/media-types/image/cgm"))
("image/example" ("https://www.iana.org/assignments/media-types/image/example"))
("image/fits" ("https://www.iana.org/assignments/media-types/image/fits"))
("image/g3fax" ("https://www.iana.org/assignments/media-types/image/g3fax"))
("image/jp2" ("https://www.iana.org/assignments/media-types/image/jp2"))
("image/jpm" ("https://www.iana.org/assignments/media-types/image/jpm"))
("image/jpx" ("https://www.iana.org/assignments/media-types/image/jpx"))
("image/naplps" ("https://www.iana.org/assignments/media-types/image/naplps"))
("image/png" ("https://www.iana.org/assignments/media-types/image/png"))
("image/pwg-raster" ("https://www.iana.org/assignments/media-types/image/pwg-raster"))
("image/t38" ("https://www.iana.org/assignments/media-types/image/t38"))
("image/tiff" ("https://www.iana.org/assignments/media-types/image/tiff"))
("image/tiff-fx" ("https://www.iana.org/assignments/media-types/image/tiff-fx"))
("message/cpim" ("https://www.iana.org/assignments/media-types/message/CPIM"))
("message/delivery-status" ("https://www.iana.org/assignments/media-types/message/delivery-status"))
("message/disposition-notification" ("https://www.iana.org/assignments/media-types/message/disposition-notification"))
("message/example" ("https://www.iana.org/assignments/media-types/message/example"))
("message/feedback-report" ("https://www.iana.org/assignments/media-types/message/feedback-report"))
("message/global" ("https://www.iana.org/assignments/media-types/message/global"))
("message/global-delivery-status" ("https://www.iana.org/assignments/media-types/message/global-delivery-status"))
("message/global-disposition-notification" ("https://www.iana.org/assignments/media-types/message/global-disposition-notification"))
("message/global-headers" ("https://www.iana.org/assignments/media-types/message/global-headers"))
("message/http" ("https://www.iana.org/assignments/media-types/message/http"))
("message/s-http" ("https://www.iana.org/assignments/media-types/message/s-http"))
("message/sip" ("https://www.iana.org/assignments/media-types/message/sip"))
("message/sipfrag" ("https://www.iana.org/assignments/media-types/message/sipfrag"))
("message/tracking-status" ("https://www.iana.org/assignments/media-types/message/tracking-status"))
("model/example" ("https://www.iana.org/assignments/media-types/model/example"))
("model/iges" ("https://www.iana.org/assignments/media-types/model/iges"))
("model/x3d-vrml" ("https://www.iana.org/assignments/media-types/model/x3d-vrml"))
("multipart/appledouble" ("https://www.iana.org/assignments/media-types/multipart/appledouble"))
("multipart/byteranges" ("https://www.iana.org/assignments/media-types/multipart/byteranges"))
("multipart/encrypted" ("https://www.iana.org/assignments/media-types/multipart/encrypted"))
("multipart/example" ("https://www.iana.org/assignments/media-types/multipart/example"))
("multipart/form-data" ("https://www.iana.org/assignments/media-types/multipart/form-data"))
("multipart/header-set" ("https://www.iana.org/assignments/media-types/multipart/header-set"))
("multipart/related" ("https://www.iana.org/assignments/media-types/multipart/related"))
("multipart/report" ("https://www.iana.org/assignments/media-types/multipart/report"))
("multipart/signed" ("https://www.iana.org/assignments/media-types/multipart/signed"))
("multipart/voice-message" ("https://www.iana.org/assignments/media-types/multipart/voice-message"))
("multipart/x-mixed-replace" ("https://www.iana.org/assignments/media-types/multipart/x-mixed-replace"))
("text/1d-interleaved-parityfec" ("https://www.iana.org/assignments/media-types/text/1d-interleaved-parityfec"))
("text/cache-manifest" ("https://www.iana.org/assignments/media-types/text/cache-manifest"))
("text/calendar" ("https://www.iana.org/assignments/media-types/text/calendar"))
("text/css" ("https://www.iana.org/assignments/media-types/text/css"))
("text/csv" ("https://www.iana.org/assignments/media-types/text/csv"))
("text/csv-schema" ("https://www.iana.org/assignments/media-types/text/csv-schema"))
("text/dns" ("https://www.iana.org/assignments/media-types/text/dns"))
("text/encaprtp" ("https://www.iana.org/assignments/media-types/text/encaprtp"))
("text/example" ("https://www.iana.org/assignments/media-types/text/example"))
("text/fwdred" ("https://www.iana.org/assignments/media-types/text/fwdred"))
("text/grammar-ref-list" ("https://www.iana.org/assignments/media-types/text/grammar-ref-list"))
("text/html" ("https://www.iana.org/assignments/media-types/text/html"))
("text/jcr-cnd" ("https://www.iana.org/assignments/media-types/text/jcr-cnd"))
("text/markdown" ("https://www.iana.org/assignments/media-types/text/markdown"))
("text/mizar" ("https://www.iana.org/assignments/media-types/text/mizar"))
("text/n3" ("https://www.iana.org/assignments/media-types/text/n3"))
("text/parameters" ("https://www.iana.org/assignments/media-types/text/parameters"))
("text/provenance-notation" ("https://www.iana.org/assignments/media-types/text/provenance-notation"))
("text/raptorfec" ("https://www.iana.org/assignments/media-types/text/raptorfec"))
("text/red" ("https://www.iana.org/assignments/media-types/text/RED"))
("text/rfc822-headers" ("https://www.iana.org/assignments/media-types/text/rfc822-headers"))
("text/rtf" ("https://www.iana.org/assignments/media-types/text/rtf"))
("text/rtp-enc-aescm128" ("https://www.iana.org/assignments/media-types/text/rtp-enc-aescm128"))
("text/rtploopback" ("https://www.iana.org/assignments/media-types/text/rtploopback"))
("text/rtx" ("https://www.iana.org/assignments/media-types/text/rtx"))
("text/sgml" ("https://www.iana.org/assignments/media-types/text/SGML"))
("text/t140" ("https://www.iana.org/assignments/media-types/text/t140"))
("text/tab-separated-values" ("https://www.iana.org/assignments/media-types/text/tab-separated-values"))
("text/troff" ("https://www.iana.org/assignments/media-types/text/troff"))
("text/turtle" ("https://www.iana.org/assignments/media-types/text/turtle"))
("text/ulpfec" ("https://www.iana.org/assignments/media-types/text/ulpfec"))
("text/uri-list" ("https://www.iana.org/assignments/media-types/text/uri-list"))
("text/vcard" ("https://www.iana.org/assignments/media-types/text/vcard"))
("text/xml" ("https://www.iana.org/assignments/media-types/text/xml"))
("text/xml-external-parsed-entity" ("https://www.iana.org/assignments/media-types/text/xml-external-parsed-entity"))
("video/1d-interleaved-parityfec" ("https://www.iana.org/assignments/media-types/video/1d-interleaved-parityfec"))
("video/3gpp" ("https://www.iana.org/assignments/media-types/video/3gpp"))
("video/3gpp2" ("https://www.iana.org/assignments/media-types/video/3gpp2"))
("video/3gpp-tt" ("https://www.iana.org/assignments/media-types/video/3gpp-tt"))
("video/bmpeg" ("https://www.iana.org/assignments/media-types/video/BMPEG"))
("video/bt656" ("https://www.iana.org/assignments/media-types/video/BT656"))
("video/celb" ("https://www.iana.org/assignments/media-types/video/CelB"))
("video/dv" ("https://www.iana.org/assignments/media-types/video/DV"))
("video/encaprtp" ("https://www.iana.org/assignments/media-types/video/encaprtp"))
("video/example" ("https://www.iana.org/assignments/media-types/video/example"))
("video/h261" ("https://www.iana.org/assignments/media-types/video/H261"))
("video/h263" ("https://www.iana.org/assignments/media-types/video/H263"))
("video/h263-1998" ("https://www.iana.org/assignments/media-types/video/H263-1998"))
("video/h263-2000" ("https://www.iana.org/assignments/media-types/video/H263-2000"))
("video/h264" ("https://www.iana.org/assignments/media-types/video/H264"))
("video/h264-rcdo" ("https://www.iana.org/assignments/media-types/video/H264-RCDO"))
("video/h264-svc" ("https://www.iana.org/assignments/media-types/video/H264-SVC"))
("video/h265" ("https://www.iana.org/assignments/media-types/video/H265"))
("video/jpeg" ("https://www.iana.org/assignments/media-types/video/JPEG"))
("video/jpeg2000" ("https://www.iana.org/assignments/media-types/video/jpeg2000"))
("video/mj2" ("https://www.iana.org/assignments/media-types/video/mj2"))
("video/mp1s" ("https://www.iana.org/assignments/media-types/video/MP1S"))
("video/mp2p" ("https://www.iana.org/assignments/media-types/video/MP2P"))
("video/mp2t" ("https://www.iana.org/assignments/media-types/video/MP2T"))
("video/mp4" ("https://www.iana.org/assignments/media-types/video/mp4"))
("video/mp4v-es" ("https://www.iana.org/assignments/media-types/video/MP4V-ES"))
("video/mpv" ("https://www.iana.org/assignments/media-types/video/MPV"))
("video/mpeg4-generic" ("https://www.iana.org/assignments/media-types/video/mpeg4-generic"))
("video/nv" ("https://www.iana.org/assignments/media-types/video/nv"))
("video/ogg" ("https://www.iana.org/assignments/media-types/video/ogg"))
("video/pointer" ("https://www.iana.org/assignments/media-types/video/pointer"))
("video/quicktime" ("https://www.iana.org/assignments/media-types/video/quicktime"))
("video/raptorfec" ("https://www.iana.org/assignments/media-types/video/raptorfec"))
("video/rtp-enc-aescm128" ("https://www.iana.org/assignments/media-types/video/rtp-enc-aescm128"))
("video/rtploopback" ("https://www.iana.org/assignments/media-types/video/rtploopback"))
("video/rtx" ("https://www.iana.org/assignments/media-types/video/rtx"))
("video/smpte292m" ("https://www.iana.org/assignments/media-types/video/SMPTE292M"))
("video/ulpfec" ("https://www.iana.org/assignments/media-types/video/ulpfec"))
("video/vc1" ("https://www.iana.org/assignments/media-types/video/vc1"))
("video/vp8" ("https://www.iana.org/assignments/media-types/video/VP8"))))
;;;###autoload
(defun media-type (media-type)
"Display the template of a media-type"
(interactive
(list (completing-read "Enter media-type: " media-types)))
(let* ((lowercased-media-type (downcase media-type))
(found (assoc lowercased-media-type media-types)))
(if found
(let ((template (car (cdr found))))
(message
"%s - media-type\n%s"
lowercased-media-type (car template) ))
(message "%s - media-type\nUNKNOWN" lowercased-media-type))
))
(provide 'media-types)
;;; media-types.el ends here

View File

@ -0,0 +1,44 @@
;;; restclient-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "restclient" "restclient.el" (22538 5601 790846
;;;;;; 80000))
;;; Generated autoloads from restclient.el
(autoload 'restclient-http-send-current "restclient" "\
Sends current request.
Optional argument RAW don't reformat response if t.
Optional argument STAY-IN-WINDOW do not move focus to response buffer if t.
\(fn &optional RAW STAY-IN-WINDOW)" t nil)
(autoload 'restclient-http-send-current-raw "restclient" "\
Sends current request and get raw result (no reformatting or syntax highlight of XML, JSON or images).
\(fn)" t nil)
(autoload 'restclient-http-send-current-stay-in-window "restclient" "\
Send current request and keep focus in request window.
\(fn)" t nil)
(autoload 'restclient-mode "restclient" "\
Turn on restclient mode.
\(fn)" t nil)
;;;***
;;;### (autoloads nil nil ("restclient-pkg.el") (22538 5600 878847
;;;;;; 896000))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; restclient-autoloads.el ends here

View File

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "restclient" "20160801.707" "An interactive HTTP client for Emacs" 'nil :keywords '("http"))

View File

@ -0,0 +1,553 @@
;;; restclient.el --- An interactive HTTP client for Emacs
;;
;; Public domain.
;; Author: Pavel Kurnosov <pashky@gmail.com>
;; Maintainer: Pavel Kurnosov <pashky@gmail.com>
;; Created: 01 Apr 2012
;; Keywords: http
;; Package-Version: 20160801.707
;; This file is not part of GNU Emacs.
;; This file is public domain software. Do what you want.
;;; Commentary:
;;
;; This is a tool to manually explore and test HTTP REST
;; webservices. Runs queries from a plain-text query sheet, displays
;; results as a pretty-printed XML, JSON and even images.
;;; Code:
;;
(require 'url)
(require 'json)
(defgroup restclient nil
"An interactive HTTP client for Emacs."
:group 'tools)
(defcustom restclient-log-request t
"Log restclient requests to *Messages*."
:group 'restclient
:type 'boolean)
(defcustom restclient-same-buffer-response t
"Re-use same buffer for responses or create a new one each time."
:group 'restclient
:type 'boolean)
(defcustom restclient-same-buffer-response-name "*HTTP Response*"
"Name for response buffer."
:group 'restclient
:type 'string)
(defcustom restclient-inhibit-cookies nil
"Inhibit restclient from sending cookies implicitly."
:group 'restclient
:type 'boolean)
(defgroup restclient-faces nil
"Faces used in Restclient Mode"
:group 'restclient
:group 'faces)
(defface restclient-variable-name-face
'((t (:inherit font-lock-preprocessor-face)))
"Face for variable name."
:group 'restclient-faces)
(defface restclient-variable-string-face
'((t (:inherit font-lock-string-face)))
"Face for variable value (string)."
:group 'restclient-faces)
(defface restclient-variable-elisp-face
'((t (:inherit font-lock-function-name-face)))
"Face for variable value (Emacs lisp)."
:group 'restclient-faces)
(defface restclient-variable-multiline-face
'((t (:inherit font-lock-doc-face)))
"Face for multi-line variable value marker."
:group 'restclient-faces)
(defface restclient-variable-usage-face
'((t (:inherit restclient-variable-name-face)))
"Face for variable usage (only used when headers/body is represented as a single variable, not highlighted when variable appears in the middle of other text)."
:group 'restclient-faces)
(defface restclient-method-face
'((t (:inherit font-lock-keyword-face)))
"Face for HTTP method."
:group 'restclient-faces)
(defface restclient-url-face
'((t (:inherit font-lock-function-name-face)))
"Face for variable value (Emacs lisp)."
:group 'restclient-faces)
(defface restclient-file-upload-face
'((t (:inherit restclient-variable-multiline-face)))
"Face for highlighting upload file paths."
:group 'restclient-faces)
(defface restclient-header-name-face
'((t (:inherit font-lock-variable-name-face)))
"Face for HTTP header name."
:group 'restclient-faces)
(defface restclient-header-value-face
'((t (:inherit font-lock-string-face)))
"Face for HTTP header value."
:group 'restclient-faces)
(defvar restclient-within-call nil)
(defvar restclient-request-time-start nil)
(defvar restclient-request-time-end nil)
(defvar restclient-response-loaded-hook nil
"Hook run after response buffer created and data loaded.")
(defvar restclient-http-do-hook nil
"Hook to run before making request.")
(defcustom restclient-vars-max-passes 10
"Maximum number of recursive variable references. This is to prevent hanging if two variables reference each other directly or indirectly."
:group 'restclient
:type 'integer)
(defconst restclient-comment-separator "#")
(defconst restclient-comment-start-regexp (concat "^" restclient-comment-separator))
(defconst restclient-comment-not-regexp (concat "^[^" restclient-comment-separator "]"))
(defconst restclient-empty-line-regexp "^\\s-*$")
(defconst restclient-method-url-regexp
"^\\(GET\\|POST\\|DELETE\\|PUT\\|HEAD\\|OPTIONS\\|PATCH\\) \\(.*\\)$")
(defconst restclient-header-regexp
"^\\([^](),/:;@[\\{}= \t]+\\): \\(.*\\)$")
(defconst restclient-use-var-regexp
"^\\(:[^: \n]+\\)$")
(defconst restclient-var-regexp
(concat "^\\(:[^: ]+\\)[ \t]*\\(:?\\)=[ \t]*\\(<<[ \t]*\n\\(\\(.*\n\\)*?\\)" restclient-comment-separator "\\|\\([^<].*\\)$\\)"))
(defconst restclient-svar-regexp
"^\\(:[^: ]+\\)[ \t]*=[ \t]*\\(.+?\\)$")
(defconst restclient-evar-regexp
"^\\(:[^: ]+\\)[ \t]*:=[ \t]*\\(.+?\\)$")
(defconst restclient-mvar-regexp
"^\\(:[^: ]+\\)[ \t]*:?=[ \t]*\\(<<\\)[ \t]*$")
(defconst restclient-file-regexp
"^<[ \t]*\\([^<>]+\\)[ \t]*$")
(defconst restclient-content-type-regexp
"^Content-[Tt]ype: \\(\\w+\\)/\\(?:[^\\+\r\n]*\\+\\)*\\([^;\r\n]+\\)")
;; The following disables the interactive request for user name and
;; password should an API call encounter a permission-denied response.
;; This API is meant to be usable without constant asking for username
;; and password.
(defadvice url-http-handle-authentication (around restclient-fix)
(if restclient-within-call
(setq ad-return-value t)
ad-do-it))
(ad-activate 'url-http-handle-authentication)
(defadvice url-cache-extract (around restclient-fix-2)
(unless restclient-within-call
ad-do-it))
(ad-activate 'url-cache-extract)
(defadvice url-http-user-agent-string (around restclient-fix-3)
(if restclient-within-call
(setq ad-return-value nil)
ad-do-it))
(ad-activate 'url-http-user-agent-string)
(defun restclient-restore-header-variables ()
(url-set-mime-charset-string)
(setq url-mime-language-string nil)
(setq url-mime-encoding-string nil)
(setq url-mime-accept-string nil)
(setq url-personal-mail-address nil))
(defun restclient-http-do (method url headers entity &rest handle-args)
"Send ENTITY and HEADERS to URL as a METHOD request."
(if restclient-log-request
(message "HTTP %s %s Headers:[%s] Body:[%s]" method url headers entity))
(let ((url-request-method method)
(url-request-extra-headers '())
(url-request-data (encode-coding-string entity 'utf-8)))
(restclient-restore-header-variables)
(dolist (header headers)
(let* ((mapped (assoc-string (downcase (car header))
'(("from" . url-personal-mail-address)
("accept-encoding" . url-mime-encoding-string)
("accept-charset" . url-mime-charset-string)
("accept-language" . url-mime-language-string)
("accept" . url-mime-accept-string)))))
(if mapped
(set (cdr mapped) (cdr header))
(setq url-request-extra-headers (cons header url-request-extra-headers)))
))
(setq restclient-within-call t)
(setq restclient-request-time-start (current-time))
(run-hooks 'restclient-http-do-hook)
(url-retrieve url 'restclient-http-handle-response
(append (list method url (if restclient-same-buffer-response
restclient-same-buffer-response-name
(format "*HTTP %s %s*" method url))) handle-args) nil restclient-inhibit-cookies)))
(defun restclient-prettify-response (method url)
(save-excursion
(let ((start (point)) (guessed-mode) (end-of-headers))
(while (and (not (looking-at restclient-empty-line-regexp))
(eq (progn
(when (looking-at restclient-content-type-regexp)
(setq guessed-mode
(cdr (assoc-string (concat
(match-string-no-properties 1)
"/"
(match-string-no-properties 2))
'(("text/xml" . xml-mode)
("application/xml" . xml-mode)
("application/json" . js-mode)
("image/png" . image-mode)
("image/jpeg" . image-mode)
("image/jpg" . image-mode)
("image/gif" . image-mode)
("text/html" . html-mode))))))
(forward-line)) 0)))
(setq end-of-headers (point))
(while (and (looking-at restclient-empty-line-regexp)
(eq (forward-line) 0)))
(unless guessed-mode
(setq guessed-mode
(or (assoc-default nil
;; magic mode matches
'(("<\\?xml " . xml-mode)
("{\\s-*\"" . js-mode))
(lambda (re _dummy)
(looking-at re))) 'js-mode)))
(let ((headers (buffer-substring-no-properties start end-of-headers)))
(when guessed-mode
(delete-region start (point))
(unless (eq guessed-mode 'image-mode)
(apply guessed-mode '())
(if (fboundp 'font-lock-flush)
(font-lock-flush)
(with-no-warnings
(font-lock-fontify-buffer))))
(cond
((eq guessed-mode 'xml-mode)
(goto-char (point-min))
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region (point-min) (point-max)))
((eq guessed-mode 'image-mode)
(let* ((img (buffer-string)))
(delete-region (point-min) (point-max))
(fundamental-mode)
(insert-image (create-image img nil t))))
((eq guessed-mode 'js-mode)
(let ((json-special-chars (remq (assoc ?/ json-special-chars) json-special-chars)))
(ignore-errors (json-pretty-print-buffer)))
(restclient-prettify-json-unicode)))
(goto-char (point-max))
(or (eq (point) (point-min)) (insert "\n"))
(let ((hstart (point)))
(insert method " " url "\n" headers)
(insert (format "Request duration: %fs\n" (float-time (time-subtract restclient-request-time-end restclient-request-time-start))))
(unless (eq guessed-mode 'image-mode)
(comment-region hstart (point))
(indent-region hstart (point)))))))))
(defun restclient-prettify-json-unicode ()
(save-excursion
(goto-char (point-min))
(while (re-search-forward "\\\\[Uu]\\([0-9a-fA-F]\\{4\\}\\)" nil t)
(replace-match (char-to-string (decode-char 'ucs (string-to-number (match-string 1) 16))) t nil))))
(defun restclient-http-handle-response (status method url bufname raw stay-in-window)
"Switch to the buffer returned by `url-retreive'.
The buffer contains the raw HTTP response sent by the server."
(setq restclient-within-call nil)
(setq restclient-request-time-end (current-time))
(if (= (point-min) (point-max))
(signal (car (plist-get status :error)) (cdr (plist-get status :error)))
(restclient-restore-header-variables)
(when (buffer-live-p (current-buffer))
(with-current-buffer (restclient-decode-response
(current-buffer)
bufname
restclient-same-buffer-response)
(unless raw
(restclient-prettify-response method url))
(buffer-enable-undo)
(run-hooks 'restclient-response-loaded-hook)
(if stay-in-window
(display-buffer (current-buffer) t)
(switch-to-buffer-other-window (current-buffer)))))))
(defun restclient-decode-response (raw-http-response-buffer target-buffer-name same-name)
"Decode the HTTP response using the charset (encoding) specified in the Content-Type header. If no charset is specified, default to UTF-8."
(let* ((charset-regexp "Content-Type.*charset=\\([-A-Za-z0-9]+\\)")
(image? (save-excursion
(search-forward-regexp "Content-Type.*[Ii]mage" nil t)))
(encoding (if (save-excursion
(search-forward-regexp charset-regexp nil t))
(intern (downcase (match-string 1)))
'utf-8)))
(if image?
;; Dont' attempt to decode. Instead, just switch to the raw HTTP response buffer and
;; rename it to target-buffer-name.
(with-current-buffer raw-http-response-buffer
;; We have to kill the target buffer if it exists, or `rename-buffer'
;; will raise an error.
(when (get-buffer target-buffer-name)
(kill-buffer target-buffer-name))
(rename-buffer target-buffer-name)
raw-http-response-buffer)
;; Else, switch to the new, empty buffer that will contain the decoded HTTP
;; response. Set its encoding, copy the content from the unencoded
;; HTTP response buffer and decode.
(let ((decoded-http-response-buffer
(get-buffer-create
(if same-name target-buffer-name (generate-new-buffer-name target-buffer-name)))))
(with-current-buffer decoded-http-response-buffer
(setq buffer-file-coding-system encoding)
(save-excursion
(erase-buffer)
(insert-buffer-substring raw-http-response-buffer))
(kill-buffer raw-http-response-buffer)
(condition-case nil
(decode-coding-region (point-min) (point-max) encoding)
(error
(message (concat "Error when trying to decode http response with encoding: "
(symbol-name encoding)))))
decoded-http-response-buffer)))))
(defun restclient-current-min ()
(save-excursion
(beginning-of-line)
(if (looking-at restclient-comment-start-regexp)
(if (re-search-forward restclient-comment-not-regexp (point-max) t)
(point-at-bol) (point-max))
(if (re-search-backward restclient-comment-start-regexp (point-min) t)
(point-at-bol 2)
(point-min)))))
(defun restclient-current-max ()
(save-excursion
(if (re-search-forward restclient-comment-start-regexp (point-max) t)
(max (- (point-at-bol) 1) 1)
(progn (goto-char (point-max))
(if (looking-at "^$") (- (point) 1) (point))))))
(defun restclient-replace-all-in-string (replacements string)
(if replacements
(let ((current string)
(pass restclient-vars-max-passes)
(continue t))
(while (and continue (> pass 0))
(setq pass (- pass 1))
(setq current (replace-regexp-in-string (regexp-opt (mapcar 'car replacements))
(lambda (key)
(setq continue t)
(cdr (assoc key replacements)))
current t t)))
current)
string))
(defun restclient-replace-all-in-header (replacements header)
(cons (car header)
(restclient-replace-all-in-string replacements (cdr header))))
(defun restclient-chop (text)
(if text (replace-regexp-in-string "\n$" "" text) nil))
(defun restclient-find-vars-before-point ()
(let ((vars nil)
(bound (point)))
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp restclient-var-regexp bound t)
(let ((name (match-string-no-properties 1))
(should-eval (> (length (match-string 2)) 0))
(value (or (restclient-chop (match-string-no-properties 4)) (match-string-no-properties 3))))
(setq vars (cons (cons name (if should-eval (restclient-eval-var value) value)) vars))))
vars)))
(defun restclient-eval-var (string)
(with-output-to-string (princ (eval (read string)))))
(defun restclient-make-header (&optional string)
(cons (match-string-no-properties 1 string)
(match-string-no-properties 2 string)))
(defun restclient-parse-headers (string)
(let ((start 0)
(headers '()))
(while (string-match restclient-header-regexp string start)
(setq headers (cons (restclient-make-header string) headers)
start (match-end 0)))
headers))
(defun restclient-read-file (path)
(with-temp-buffer
(insert-file-contents path)
(buffer-string)))
(defun restclient-parse-body (entity vars)
(if (= 0 (or (string-match restclient-file-regexp entity) 1))
(restclient-read-file (match-string 1 entity))
(restclient-replace-all-in-string vars entity)))
(defun restclient-http-parse-current-and-do (func &rest args)
(save-excursion
(goto-char (restclient-current-min))
(when (re-search-forward restclient-method-url-regexp (point-max) t)
(let ((method (match-string-no-properties 1))
(url (match-string-no-properties 2))
(vars (restclient-find-vars-before-point))
(headers '()))
(forward-line)
(while (cond
((and (looking-at restclient-header-regexp) (not (looking-at restclient-empty-line-regexp)))
(setq headers (cons (restclient-replace-all-in-header vars (restclient-make-header)) headers)))
((looking-at restclient-use-var-regexp)
(setq headers (append headers (restclient-parse-headers (restclient-replace-all-in-string vars (match-string 1)))))))
(forward-line))
(when (looking-at restclient-empty-line-regexp)
(forward-line))
(let* ((cmax (restclient-current-max))
(entity (restclient-parse-body (buffer-substring (min (point) cmax) cmax) vars))
(url (restclient-replace-all-in-string vars url)))
(apply func method url headers entity args))))))
(defun restclient-copy-curl-command ()
"Formats the request as a curl command and copies the command to the clipboard."
(interactive)
(restclient-http-parse-current-and-do
'(lambda (method url headers entity)
(kill-new (format "curl -i %s -X%s '%s' %s"
(mapconcat (lambda (header) (format "-H '%s: %s'" (car header) (cdr header))) headers " ")
method url
(if (> (string-width entity) 0)
(format "-d '%s'" entity) "")))
(message "curl command copied to clipboard."))))
;;;###autoload
(defun restclient-http-send-current (&optional raw stay-in-window)
"Sends current request.
Optional argument RAW don't reformat response if t.
Optional argument STAY-IN-WINDOW do not move focus to response buffer if t."
(interactive)
(restclient-http-parse-current-and-do 'restclient-http-do raw stay-in-window))
;;;###autoload
(defun restclient-http-send-current-raw ()
"Sends current request and get raw result (no reformatting or syntax highlight of XML, JSON or images)."
(interactive)
(restclient-http-send-current t))
;;;###autoload
(defun restclient-http-send-current-stay-in-window ()
"Send current request and keep focus in request window."
(interactive)
(restclient-http-send-current nil t))
(defun restclient-jump-next ()
"Jump to next request in buffer."
(interactive)
(let ((last-min nil))
(while (not (eq last-min (goto-char (restclient-current-min))))
(goto-char (restclient-current-min))
(setq last-min (point))))
(goto-char (+ (restclient-current-max) 1))
(goto-char (restclient-current-min)))
(defun restclient-jump-prev ()
"Jump to previous request in buffer."
(interactive)
(let* ((current-min (restclient-current-min))
(end-of-entity
(save-excursion
(progn (goto-char (restclient-current-min))
(while (and (or (looking-at "^\s*\\(#.*\\)?$")
(eq (point) current-min))
(not (eq (point) (point-min))))
(forward-line -1)
(beginning-of-line))
(point)))))
(unless (eq (point-min) end-of-entity)
(goto-char end-of-entity)
(goto-char (restclient-current-min)))))
(defun restclient-mark-current ()
"Mark current request."
(interactive)
(goto-char (restclient-current-min))
(set-mark-command nil)
(goto-char (restclient-current-max))
(backward-char 1)
(setq deactivate-mark nil))
(defun restclient-narrow-to-current ()
"Narrow to region of current request"
(interactive)
(narrow-to-region (restclient-current-min) (restclient-current-max)))
(defconst restclient-mode-keywords
(list (list restclient-method-url-regexp '(1 'restclient-method-face) '(2 'restclient-url-face))
(list restclient-svar-regexp '(1 'restclient-variable-name-face) '(2 'restclient-variable-string-face))
(list restclient-evar-regexp '(1 'restclient-variable-name-face) '(2 'restclient-variable-elisp-face t))
(list restclient-mvar-regexp '(1 'restclient-variable-name-face) '(2 'restclient-variable-multiline-face t))
(list restclient-use-var-regexp '(1 'restclient-variable-usage-face))
(list restclient-file-regexp '(0 'restclient-file-upload-face))
(list restclient-header-regexp '(1 'restclient-header-name-face t) '(2 'restclient-header-value-face t))
))
(defconst restclient-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\# "<" table)
(modify-syntax-entry ?\n ">#" table)
table))
;;;###autoload
(define-derived-mode restclient-mode fundamental-mode "REST Client"
"Turn on restclient mode."
(local-set-key (kbd "C-c C-c") 'restclient-http-send-current)
(local-set-key (kbd "C-c C-r") 'restclient-http-send-current-raw)
(local-set-key (kbd "C-c C-v") 'restclient-http-send-current-stay-in-window)
(local-set-key (kbd "C-c C-n") 'restclient-jump-next)
(local-set-key (kbd "C-c C-p") 'restclient-jump-prev)
(local-set-key (kbd "C-c C-.") 'restclient-mark-current)
(local-set-key (kbd "C-c C-u") 'restclient-copy-curl-command)
(local-set-key (kbd "C-c n n") 'restclient-narrow-to-current)
(set (make-local-variable 'comment-start) "# ")
(set (make-local-variable 'comment-start-skip) "# *")
(set (make-local-variable 'comment-column) 48)
(set (make-local-variable 'font-lock-defaults) '(restclient-mode-keywords)))
(provide 'restclient)
(eval-after-load 'helm
'(ignore-errors (require 'restclient-helm)))
;;; restclient.el ends here

View File

@ -0,0 +1,22 @@
;;; restclient-helm-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "restclient-helm" "restclient-helm.el" (22538
;;;;;; 5601 290847 75000))
;;; Generated autoloads from restclient-helm.el
(autoload 'helm-restclient "restclient-helm" "\
Helm for Restclient.
\(fn)" t nil)
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; restclient-helm-autoloads.el ends here

View File

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "restclient-helm" "20160407.249" "helm interface for restclient.el" '((restclient "0") (helm "1.9.4")) :keywords '("http" "helm"))

View File

@ -0,0 +1,76 @@
;;; restclient-helm.el --- helm interface for restclient.el
;;
;; Public domain.
;; Author: Pavel Kurnosov <pashky@gmail.com>
;; Maintainer: Pavel Kurnosov <pashky@gmail.com>
;; Created: 01 Apr 2016
;; Keywords: http helm
;; Package-Version: 20160407.249
;; Package-Requires: ((restclient "0") (helm "1.9.4"))
;; This file is not part of GNU Emacs.
;; This file is public domain software. Do what you want.
;;; Commentary:
;;
;; This is a companion to restclient.el to add helm sources for requests and variables in current restclient-mode buffer.
;;; Code:
;;
(require 'helm)
(require 'helm-utils)
(require 'restclient)
(defun restclient-helm-find-candidates-matching (regexp process)
(let ((result '()))
(with-helm-current-buffer
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(with-no-warnings
(font-lock-fontify-buffer)))
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(setq result (cons (cons (funcall process) (line-number-at-pos)) result))))
result)))
(defun restclient-helm-find-requests ()
(restclient-helm-find-candidates-matching
restclient-method-url-regexp
'(lambda () (match-string 0))))
(defun restclient-helm-find-variables ()
(restclient-helm-find-candidates-matching
restclient-var-regexp
'(lambda () (match-string 1))))
(defun restclient-helm-goto (candidate)
(switch-to-buffer helm-current-buffer)
(helm-goto-line candidate))
(defconst restclient-helm-requests-source
(helm-build-sync-source "Variables"
:action '(("Go to declaration" . restclient-helm-goto))
:candidates 'restclient-helm-find-variables))
(defconst restclient-helm-variables-source
(helm-build-sync-source "Requests"
:action '(("Go to" . restclient-helm-goto))
:candidates 'restclient-helm-find-requests))
;;;###autoload
(defun helm-restclient ()
"Helm for Restclient."
(interactive)
(helm :sources '(restclient-helm-requests-source restclient-helm-variables-source)))
(provide 'restclient-helm)
(eval-after-load 'restclient
'(progn
(define-key restclient-mode-map (kbd "C-c C-g") #'helm-restclient)))
;;; helm-restclient.el ends here
;;; restclient-helm.el ends here

View File

@ -60,6 +60,7 @@
command-log-mode
company
company-c-headers
company-restclient
company-shell
diminish
drag-stuff
@ -123,6 +124,8 @@
projectile
rainbow-delimiters
rainbow-mode
restclient
restclient-helm
sass-mode
simple-rtm
smart-mode-line
@ -621,6 +624,12 @@
;; This seems to be the default, but lets make sure…
(electric-indent-mode 1))
(use-package restclient)
(use-package company-restclient)
(use-package restclient-helm)
;; Load my own functions
(load "gnu-c-header.el")
(load "toggle-window-split.el")