`GET /tx/:txid` in regtest returns HTML instead of JSON

オープン
#496 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
api, backend

調査の方向性

まず GET /regtest/api/tx/:txid のエントリーポイントを追跡し、Accept: application/json を付けてリクエストを再現します。エンドポイントがレスポンスを選択している箇所を確認し、有効なトランザクションのレスポンスが HTML の explorer shell ではなく JSON として返されることを検証します。

索引モデルが issue の本文から書いたものです。

説明

I've defined a Rust struct that matches the specified transaction format. It appropriately derives an implementation of serde::Deserialize.

The URL for my request is defined as

let url = format!("http://127.0.0.1:5000/regtest/api/tx/{txid}");

The headers are set to Accept application/json.

The call returns a 200 response status, however, because the returned body is HTML, the following deserialization effort fails:

let tx: TxInfo = serde_json::from_slice(&response.body)?;

ERROR:
"Error(\"expected value\", line: 1, column: 1)"

Here's the full response from the API call:

STATUS:
200

HEADERS:
[HttpHeader { name: "x-powered-by", value: "Express" }, HttpHeader { name: "content-type", value: "text/html; charset=utf-8" }, HttpHeader { name: "content-length", value: "519" }, HttpHeader { name: "etag", value: "--" }, HttpHeader { name: "date", value: "Mon, 06 May 2024 --" }, HttpHeader { name: "connection", value: "close" }]

BODY:
<!DOCTYPE html><head><meta charset="utf-8"><title>Block Explorer</title><meta property="og:title" content="Block explorer"><meta name="description" content="Esplora Block Explorer"><base href="/"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="img/favicon.png"><link rel="stylesheet" href="bootstrap.min.css"><link rel="stylesheet" href="style.css"></head><body lang="en" dir="ltr"><div id="explorer"></div><script src="app.js" async></script></body>
主要言語
JavaScript
スター
1.3k
フォーク
527
平均マージ
2日 5時間
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Blockstream/esplora のほかの issue

Blockstream/esplora の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。