Blockstream / Blockstream/esplora

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

Open
#496 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.3k
Forks
514
Avg merge
1d 10h
Merged PRs (30d)
16

Description

I've defined a Rust struct that matches the specified [transaction format](https://github.com/Blockstream/esplora/blob/master/API.md#transaction-format). It appropriately derives an implementation of `serde::Deserialize`.

The URL for my request is defined as
```rust
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:
```rust
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:

```bash
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:
Block Explorer


```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.