[PR #1528] [MERGED] Fill the errors attribute for HTTP errors #1577

Closed
opened 2026-03-03 12:35:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1528
Author: @manuteleco
Created: 3/10/2024
Status: Merged
Merged: 3/13/2024
Merged by: @fsouza

Base: mainHead: fill_errors_list_in_response


📝 Commits (1)

  • 7f00251 Fill the errors attribute for HTTP errors

📊 Changes

3 files changed (+16 additions, -4 deletions)

View changed files

📝 fakestorage/json_response.go (+13 -1)
📝 fakestorage/object_test.go (+1 -1)
📝 fakestorage/upload_test.go (+2 -2)

📄 Description

Some GCS client libraries (like this one), are quite strict when it comes to the set of attributes they expect to find in the error response. If any of those attributes is missing, they fail to deserialize the error.

In fake-gcs-server, the httpError.Errors attribute was always initialized to nil, causing the error.errors JSON response attribute to be omitted and leading to failures in some client libraries.

In this commit we address that issue by always providing content on the errors attribute (httpError.Errors field) whenever we return an error response. The implementation is kept simple without aiming to return exactly the same values that are officially documented. The main goal is to have a sensible response that is structurally correct for the purposes of deserialization client-side.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/1528 **Author:** [@manuteleco](https://github.com/manuteleco) **Created:** 3/10/2024 **Status:** ✅ Merged **Merged:** 3/13/2024 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `fill_errors_list_in_response` --- ### 📝 Commits (1) - [`7f00251`](https://github.com/fsouza/fake-gcs-server/commit/7f00251eda1f39b0df25ab33f4bf64eac41d55b5) Fill the `errors` attribute for HTTP errors ### 📊 Changes **3 files changed** (+16 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/json_response.go` (+13 -1) 📝 `fakestorage/object_test.go` (+1 -1) 📝 `fakestorage/upload_test.go` (+2 -2) </details> ### 📄 Description Some GCS client libraries (like [this one][1]), are quite strict when it comes to the set of attributes they expect to find in the error response. If any of those attributes is missing, they fail to deserialize the error. In `fake-gcs-server`, the `httpError.Errors` attribute was always initialized to `nil`, causing the `error.errors` JSON response attribute to be omitted and leading to failures in some client libraries. In this commit we address that issue by always providing content on the `errors` attribute (`httpError.Errors` field) whenever we return an error response. The implementation is kept simple without aiming to return exactly the same values that are [officially documented][2]. The main goal is to have a sensible response that is _structurally_ correct for the purposes of deserialization client-side. [1]: https://crates.io/crates/google-cloud-storage [2]: https://cloud.google.com/storage/docs/json_api/v1/status-codes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:35:15 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#1577
No description provided.