This will break if httpMethod is null (the default).

Also - could you make sure that when httpMethod gets to the exec() call, that its value is either "PUT" or "POST" (all-caps). Will make it easier for the native sides if they don't need to worry about case or nulls.