A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/github/vulcanizer/commit/7aa74a5d236546aaad4105d6734a49f229e21cf0 below:

allowed nil values · github/vulcanizer@7aa74a5 · GitHub

This repository was archived by the owner on Apr 15, 2025. It is now read-only.

File tree Expand file treeCollapse file tree 2 files changed

+10

-11

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+10

-11

lines changed Original file line number Diff line number Diff line change

@@ -1186,19 +1186,19 @@ func (c *Client) SnapshotAllIndicesWithBodyParams(repository string, snapshot st

1186 1186

return errors.New("empty string for snapshot is not allowed")

1187 1187

}

1188 1188 1189 -

if bodyParams == nil {

1190 -

return errors.New("no body params provided, please use SnapshotAllIndices Function instead")

1191 -

}

1192 - 1193 1189

parsedJSON, parsingErr := json.Marshal(bodyParams)

1194 1190 1195 1191

if parsingErr != nil {

1196 1192

return parsingErr

1197 1193

}

1198 1194 1199 -

agent := c.buildPutRequest(fmt.Sprintf("_snapshot/%s/%s", repository, snapshot)).

1200 -

Set("Content-Type", "application/json").

1201 -

Send(string(parsedJSON))

1195 +

agent := c.buildPutRequest(fmt.Sprintf("_snapshot/%s/%s", repository, snapshot))

1196 + 1197 +

if bodyParams != nil {

1198 +

agent = agent.

1199 +

Set("Content-Type", "application/json").

1200 +

Send(string(parsedJSON))

1201 +

}

1202 1202 1203 1203

_, err := handleErrWithBytes(agent)

1204 1204 Original file line number Diff line number Diff line change

@@ -1430,11 +1430,10 @@ func TestSnapshotAllIndicesWithAdditionalParametersIncludeGlobalState(t *testing

1430 1430

}

1431 1431

}

1432 1432 1433 -

func TestSnapshotAllIndicesWithAdditionalParametersErr(t *testing.T) {

1433 +

func TestSnapshotAllIndicesWithAdditionalParametersNilValue(t *testing.T) {

1434 1434

testSetup := &ServerSetup{

1435 1435

Method: "PUT",

1436 1436

Path: "/_snapshot/backup-repo/snapshot1",

1437 -

Body: `{"metadata":{"taken_because":"backup before upgrading","taken_by":"user123"}}`,

1438 1437

Response: `{"acknowledged": true }`,

1439 1438

}

1440 1439

@@ -1444,8 +1443,8 @@ func TestSnapshotAllIndicesWithAdditionalParametersErr(t *testing.T) {

1444 1443 1445 1444

err := client.SnapshotAllIndicesWithBodyParams("backup-repo", "snapshot1", nil)

1446 1445 1447 -

if err == nil {

1448 -

t.Fatalf("should have thrown an error")

1446 +

if err != nil {

1447 +

t.Fatalf("Should be able to take Nil body params: %s", err)

1449 1448

}

1450 1449

}

1451 1450

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4