emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/plz-see f82b7530bb 02/10: Handle missing content-type a


From: ELPA Syncer
Subject: [elpa] externals/plz-see f82b7530bb 02/10: Handle missing content-type and content-length correctly
Date: Wed, 1 Nov 2023 18:58:45 -0400 (EDT)

branch: externals/plz-see
commit f82b7530bb224bd20c152432a03757ad46e7dd4a
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>

    Handle missing content-type and content-length correctly
---
 plzi.el | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/plzi.el b/plzi.el
index 818a61ccc7..0629b25ac6 100644
--- a/plzi.el
+++ b/plzi.el
@@ -116,20 +116,20 @@ The car is the number of buffers created so far.")
 (defvar plzi-header-line-content-type
   '(:eval
     (setq-local plzi-header-line-content-type
-                (format " | %s"
-                        (alist-get 'content-type
-                                   (plz-response-headers plzi-response))))))
+                (when-let ((ct (alist-get 'content-type
+                                          (plz-response-headers 
plzi-response))))
+                  (format " | %s" ct)))))
 
 (defvar plzi-header-line-content-length
   '(:eval
     (setq-local plzi-header-line-content-length
-                (format " | %s bytes"
-                        (alist-get 'content-length
-                                   (plz-response-headers plzi-response))))))
+                (when-let ((len (alist-get 'content-length
+                                           (plz-response-headers 
plzi-response))))
+                  (format " | %s bytes" len)))))
 
 (defvar plzi-header-line-show-headers
   '(:eval
-    (setq-local plzi-header-line-show
+    (setq-local plzi-header-line-show-headers
                 (format " | %s"
                         (buttonize "show headers"
                                    (lambda (buffer)
@@ -145,9 +145,9 @@ The car is the number of buffers created so far.")
          (error (and (plz-error-p response) response))
          (response (if error (plz-error-response error) response))
          (headers (plz-response-headers response))
-         (mode (alist-get (alist-get 'content-type headers)
-                          plzi-content-type-alist
-                          nil nil #'string-match-p))
+         (mode (when-let ((ct (alist-get 'content-type headers)))
+                 (alist-get ct plzi-content-type-alist
+                            nil nil #'string-match-p)))
          (body (plz-response-body response)))
     (with-current-buffer buffer
       (save-excursion



reply via email to

[Prev in Thread] Current Thread [Next in Thread]