Skip to content

Commit dbbc2e3

Browse files
authored
Explicitly set Content-Type to xml for pkginfo endpoint (#6)
* git ignore tweak * Set content type to XML for pkginfo endpoint
1 parent 145e0ed commit dbbc2e3

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build/
22
src/
3-
.idea
3+
.DS_Store
4+
.idea

SimpleMDMRepo.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ def get(self, resource_identifier):
128128
def put(self, resource_identifier, content):
129129
commands = ['-X', 'POST']
130130

131+
headers = None
132+
if resource_identifier.startswith('pkgsinfo'):
133+
headers = {'Content-type': 'text/xml'}
134+
131135
if len(content) > 1024:
132136
fileref, contentpath = tempfile.mkstemp()
133137
fileobj = os.fdopen(fileref, 'wb')
@@ -137,11 +141,11 @@ def put(self, resource_identifier, content):
137141
else:
138142
commands.extend(['-d', content])
139143

140-
self._curl(resource_identifier, commands=commands)
144+
self._curl(resource_identifier, commands=commands, headers=headers)
141145

142146
if contentpath:
143147
os.unlink(contentpath)
144-
148+
145149
def put_from_local_file(self, resource_identifier, local_file_path):
146150
if(resource_identifier.startswith('pkgs/')):
147151
filename = resource_identifier[len('pkgs/'):]

0 commit comments

Comments
 (0)