Skip to content

Commit 793d798

Browse files
committed
Stabilise the sort order of the headers
Without this patch the output can change from run to run depending on the hashing order of a Python dictionary.
1 parent 56f95f1 commit 793d798

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

dropbox/files/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ func (dbx *apiImpl) AlphaUpload(arg *CommitInfoWithProperties, content io.Reader
361361
}
362362

363363
headers := map[string]string{
364-
"Dropbox-API-Arg": string(b),
365364
"Content-Type": "application/octet-stream",
365+
"Dropbox-API-Arg": string(b),
366366
}
367367
if dbx.Config.AsMemberID != "" {
368368
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@@ -3106,8 +3106,8 @@ func (dbx *apiImpl) Upload(arg *CommitInfo, content io.Reader) (res *FileMetadat
31063106
}
31073107

31083108
headers := map[string]string{
3109-
"Dropbox-API-Arg": string(b),
31103109
"Content-Type": "application/octet-stream",
3110+
"Dropbox-API-Arg": string(b),
31113111
}
31123112
if dbx.Config.AsMemberID != "" {
31133113
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@@ -3182,8 +3182,8 @@ func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Rea
31823182
}
31833183

31843184
headers := map[string]string{
3185-
"Dropbox-API-Arg": string(b),
31863185
"Content-Type": "application/octet-stream",
3186+
"Dropbox-API-Arg": string(b),
31873187
}
31883188
if dbx.Config.AsMemberID != "" {
31893189
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@@ -3250,8 +3250,8 @@ func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content i
32503250
}
32513251

32523252
headers := map[string]string{
3253-
"Dropbox-API-Arg": string(b),
32543253
"Content-Type": "application/octet-stream",
3254+
"Dropbox-API-Arg": string(b),
32553255
}
32563256
if dbx.Config.AsMemberID != "" {
32573257
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@@ -3318,8 +3318,8 @@ func (dbx *apiImpl) UploadSessionFinish(arg *UploadSessionFinishArg, content io.
33183318
}
33193319

33203320
headers := map[string]string{
3321-
"Dropbox-API-Arg": string(b),
33223321
"Content-Type": "application/octet-stream",
3322+
"Dropbox-API-Arg": string(b),
33233323
}
33243324
if dbx.Config.AsMemberID != "" {
33253325
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@@ -3535,8 +3535,8 @@ func (dbx *apiImpl) UploadSessionStart(arg *UploadSessionStartArg, content io.Re
35353535
}
35363536

35373537
headers := map[string]string{
3538-
"Dropbox-API-Arg": string(b),
35393538
"Content-Type": "application/octet-stream",
3539+
"Dropbox-API-Arg": string(b),
35403540
}
35413541
if dbx.Config.AsMemberID != "" {
35423542
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID

generator/go_client.stoneg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _generate_request(self, namespace, route):
125125
headers["Content-Type"] = '"application/octet-stream"'
126126

127127
out('headers := map[string]string{')
128-
for k, v in headers.items():
128+
for k, v in sorted(headers.items()):
129129
out('\t"{}": {},'.format(k, v))
130130
out('}')
131131
if auth != 'noauth' and auth != 'team':

0 commit comments

Comments
 (0)